home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / patches / samba-1.028 / samba-1
Text File  |  1995-09-15  |  117KB  |  3,965 lines

  1. diff -u -r --new-file last-version/docs/MIRRORS samba-1.9.14alpha17/docs/MIRRORS
  2. --- last-version/docs/MIRRORS    Sun Jun  4 15:39:15 1995
  3. +++ samba-1.9.14alpha17/docs/MIRRORS    Fri Sep 15 19:02:39 1995
  4. @@ -7,6 +7,8 @@
  5.  ftp://ftp.demon.co.uk/pub/unix/samba
  6.  ftp://sunsite.unc.edu/pub/Linux/system/Network/Samba/
  7.  ftp://ftp.choc.apana.org.au/pub/samba
  8. +ftp://ftp.uni-trier.de/pub/unix/network/samba/
  9. +
  10.  
  11.  There are several others. Give archie a try.
  12.  
  13. diff -u -r --new-file last-version/docs/README.jis samba-1.9.14alpha17/docs/README.jis
  14. --- last-version/docs/README.jis    Sat Dec 10 15:57:14 1994
  15. +++ samba-1.9.14alpha17/docs/README.jis    Fri Sep 15 20:17:28 1995
  16. @@ -1,8 +1,8 @@
  17. -$B!|(B samba $B4A;zBP1~$K$D$$$F(B
  18. +$B!|(B samba $BF|K\8lBP1~$K$D$$$F(B
  19.  
  20. -0. $BL\E*(B
  21. +1. $BL\E*(B
  22.  
  23. -  $B4A;zBP1~$N<g$JL\E*$O!"(B
  24. +  $BF|K\8lBP1~$O!"(B
  25.  
  26.      (1) MS-Windows $B>e$G!"4A;z%U%!%$%kL>$r$I$&$7$F$b07$&I,MW$N$"$k%"%W%j%1!<%7%g%s$,$A$c(B
  27.          $B$s$HF0:n$9$k!#Nc$($P!"(BMS-WORD 5 $B$J$I$O!"%$%s%9%H!<%k;~$K4A;z$N%U%!%$%kL>$r>!<j(B
  28. @@ -10,10 +10,12 @@
  29.  
  30.      (2) UNIX $B$O!":G6a$G$O$[$H$s$I$N$b$N$,(B 8 bits $B$N%U%!%$%kL>$r%5%]!<%H$7$F$$$^$9$,!"(B
  31.          $BCf$K$O!"$3$l$r%5%]!<%H$7$F$$$J$$$b$N$b$"$j$^$9!#$3$N$h$&$J>l9g$G$b!"(B(1)$B$NL\E*(B
  32. -        $B$,2L$?$;$k$h$&$K$9$k!#(B
  33. +        $B$,K~B-$G$-$k$h$&$K$9$k!#(B
  34.  
  35. -1. $BMxMQJ}K!(B
  36. +  $B$rL\E*$H$7$F$$$^$9!#$=$N$?$a!"F|K\8lBP1~$O!"I,MW:G>.8B$7$+9T$J$C$F$*$j$^$;$s!#(B
  37.  
  38. +2. $BMxMQJ}K!(B
  39. +
  40.  (1) $BDI2C$7$?%Q%i%a!<%?(B
  41.  
  42.    smb.conf $B%U%!%$%k$N(B global $B%;%/%7%g%s$K0J2<$N%Q%i%a!<%?$r@_Dj$G$-$k$h$&$K$7$^$7$?!#(B
  43. @@ -27,27 +29,43 @@
  44.  
  45.      sjis:  SHIFT JIS (MS $B4A;z%3!<%I(B) 
  46.      euc:   EUC $B%3!<%I(B
  47. -    jis7:  7 bits JIS $B%3!<%I$G$9!#%7%U%H%3!<%I$O!"$=$l$>$l!"0J2<$NDL$j$G$9!#(B
  48. -         $B4A;z$N;O$^$j(B: \E $ B  $B$+(B  \E $ @
  49. -             $B4A;z$N=*$j(B:  \E ( J  $B$+(B \E ( B $B$+(B \E ( H
  50. -           $B$3$l$i$O!"$9$G$KB8:_$7$F$$$k%U%!%$%kL>$NCf$NJ8;z%3!<%I$rFI$_9~$`;~$K;H$$$^(B
  51. -           $B$9!#?7$7$$%U%!%$%k$r:n$k;~$O!"%G%U%)%k%H$G!"(B
  52. -         $B4A;z$N;O$^$j(B: \E $ B
  53. -             $B4A;z$N=*$j(B:  \E ( J
  54. -           $B$G$9!#%3%s%Q%$%k$N%*%W%7%g%s$GJQ992DG=$G$9!#(B
  55. -       $B$^$?!"H>3Q%+%?%+%J$O!"(B
  56. -         $BH>3Q%+%?%+%J3+;O(B: 0x0e
  57. -         $BH>3Q%+%?%+%J=*N;(B: 0x0f
  58. -       $B$G$9!#(B
  59. -    jis8: 8 bits JIS $B%3!<%I$G$9!#4A;z$N$?$a$N%7%U%H%3!<%I$O(B jis7 $B$HF1$8$G$9!#H>3Q%+%?(B
  60. -      $B%+%J$K$O%7%U%H%3!<%I$O$D$-$^$;$s!#(B
  61. -    junet: jis7 $B$NH>3Q%+%?%+%J$N%7%U%H%3!<%I$,0J2<$N$h$&$KJQ$o$k0J30!"(Bjis7 $B$HF1$8$G$9!#(B
  62. -         $BH>3Q%+%?%+%J3+;O(B: \E ( I
  63. -         $BH>3Q%+%?%+%J=*N;(B: $B4A;z$N=*$j$HF1$8(B
  64.      hex:  7 bits $B$N(B ASCII $B%3!<%I0J30$N%3!<%I$r0J2<$N7A<0$GI=$9J}<0$G$9!#Nc$($P!"(B
  65.        '$B%*%U%#%9(B' $B$H$$$&L>A0$O!"(B':83:49:83:74:83:42:83:58' $B$N$h$&$K!"(B':' $B$N8e$K#27e(B
  66.            $B$N(B16$B?J?t$rB3$1$k7A<0$K$J$j$^$9!#(B
  67. -
  68. +      $B$3$3$G!"(B':' $B$rB>$NJ8;z$KJQ99$7$?$$>l9g$O!"(Bhex $B$N8e$m$K$=$NJ8;z$r;XDj$7$^$9!#(B
  69. +          $BNc$($P!"(B@$B$rJQ$o$j$K;H$$$?$$>l9g$O!"(B'hex@'$B$N$h$&$K;XDj$7$^$9!#(B
  70. +    JIS $B%3!<%I$K$D$$$F$O!"0J2<$NI=$r;2>H$7$F2<$5$$!#(B
  71. +    $B(#(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(!(!(!(!(!($(B
  72. +    $B(";XDj(B  $B("4A;z3+;O("4A;z=*N;("%+%J3+;O("%+%J=*N;("1Q?t3+;O("Hw9M(B              $B("(B
  73. +    $B('(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(!(!(!(!(!()(B
  74. +    $B("(Bjis7  $B("(B\E$B    $B("(B\E(J    $B("(B0x0e    $B("(B0x0f    $B("(B\E(J    $B("(Bjis 7$BC10LId9f(B     $B("(B
  75. +    $B("(Bjunet $B("(B\E$B    $B("(B\E(J    $B("(B\E(I    $B("(B\E(J    $B("(B\E(J    $B("(B7bits $B%3!<%I(B      $B("(B
  76. +    $B("(Bjis8  $B("(B\E$B    $B("(B\E(J    $B("(B--      $B("(B--      $B("(B\E(J    $B("(Bjis 8$BC10LId9f(B     $B("(B
  77. +    $B("(Bj7bb  $B("(B\E$B    $B("(B\E(B    $B("(B0x0e    $B("(B0x0f    $B("(B\E(B    $B("(B                  $B("(B
  78. +    $B("(Bj7bj  $B("(B\E$B    $B("(B\E(J    $B("(B0x0e    $B("(B0x0f    $B("(B\E(J    $B("(Bjis7$B$HF1$8(B        $B("(B
  79. +    $B("(Bj7bh  $B("(B\E$B    $B("(B\E(H    $B("(B0x0e    $B("(B0x0f    $B("(B\E(H    $B("(B                  $B("(B
  80. +    $B("(Bj7@b  $B("(B\E$@    $B("(B\E(B    $B("(B0x0e    $B("(B0x0f    $B("(B\E(B    $B("(B                  $B("(B
  81. +    $B("(Bj7@j  $B("(B\E$@    $B("(B\E(J    $B("(B0x0e    $B("(B0x0f    $B("(B\E(J    $B("(B                  $B("(B
  82. +    $B("(Bj7@h  $B("(B\E$@    $B("(B\E(H    $B("(B0x0e    $B("(B0x0f    $B("(B\E(H    $B("(B                  $B("(B
  83. +    $B("(Bj8bb  $B("(B\E$B    $B("(B\E(B    $B("(B--      $B("(B--      $B("(B\E(B    $B("(B                  $B("(B
  84. +    $B("(Bj8bj  $B("(B\E$B    $B("(B\E(J    $B("(B--      $B("(B--      $B("(B\E(J    $B("(Bjis8$B$HF1$8(B        $B("(B
  85. +    $B("(Bj8bh  $B("(B\E$B    $B("(B\E(H    $B("(B--      $B("(B--      $B("(B\E(H    $B("(B                  $B("(B
  86. +    $B("(Bj8@b  $B("(B\E@@    $B("(B\E(B    $B("(B--      $B("(B--      $B("(B\E(B    $B("(B                  $B("(B
  87. +    $B("(Bj8@j  $B("(B\E$@    $B("(B\E(J    $B("(B--      $B("(B--      $B("(B\E(J    $B("(B                  $B("(B
  88. +    $B("(Bj8@h  $B("(B\E$@    $B("(B\E(H    $B("(B--      $B("(B--      $B("(B\E(H    $B("(B                  $B("(B
  89. +    $B("(Bjubb  $B("(B\E$B    $B("(B\E(B    $B("(B\E(I    $B("(B\E(B    $B("(B\E(B    $B("(B                  $B("(B
  90. +    $B("(Bjubj  $B("(B\E$B    $B("(B\E(J    $B("(B\E(I    $B("(B\E(J    $B("(B\E(J    $B("(Bjunet$B$HF1$8(B       $B("(B
  91. +    $B("(Bjubh  $B("(B\E$B    $B("(B\E(H    $B("(B\E(I    $B("(B\E(H    $B("(B\E(H    $B("(B                  $B("(B
  92. +    $B("(Bju@b  $B("(B\E$@    $B("(B\E(B    $B("(B\E(I    $B("(B\E(B    $B("(B\E(B    $B("(B                  $B("(B
  93. +    $B("(Bju@j  $B("(B\E$@    $B("(B\E(J    $B("(B\E(I    $B("(B\E(J    $B("(B\E(J    $B("(B                  $B("(B
  94. +    $B("(Bju@h  $B("(B\E$@    $B("(B\E(H    $B("(B\E(I    $B("(B\E(H    $B("(B\E(H    $B("(B                  $B("(B
  95. +    $B(&(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(!(!(!(!(!(%(B
  96. +    
  97. +    $B$$$:$l$N>l9g$b!"$9$G$KB8:_$7$F$$$kL>A0$KBP$7$F$O!"4A;z$N3+;O=*N;%7!<%1%s%9$O!"0J2<(B
  98. +    $B$N$b$N$rG'<1$7$^$9!#(B
  99. +     $B4A;z$N;O$^$j(B: \E$B  $B$+(B  \E$@
  100. +         $B4A;z$N=*$j(B:  \E(J  $B$+(B \E(B $B$+(B \E(H
  101. +    
  102.  (2) smbclient $B$N%*%W%7%g%s(B
  103.  
  104.    $B%/%i%$%"%s%H%W%m%0%i%`$G$b!"4A;z$d2>L>$r4^$s$@%U%!%$%k$r07$($k$h$&$K!"<!$N%*%W%7%g%s(B
  105. @@ -61,25 +79,17 @@
  106.  
  107.    $B%G%U%)%k%H$N%3!<%I7O$O!"%3%s%Q%$%k;~$K7h$^$j$^$9!#(B
  108.  
  109. -2. $B%3%s%Q%$%k;~$N@_Dj(B
  110. +3. $B%3%s%Q%$%k;~$N@_Dj(B
  111.  
  112.    Makefile $B$K@_Dj$9$k9`L\$r0J2<$K<($7$^$9!#(B
  113.  
  114.  (1) KANJI $B%U%i%0(B
  115.  
  116. -  $B%3%s%Q%$%k%*%W%7%g%s$K(B -DKANJI=\"$B%3!<%I7O(B\" $B$r;XDj$7$^$9!#$3$N%3!<%I7O$O(B 1. $B$G;X(B
  117. +  $B%3%s%Q%$%k%*%W%7%g%s$K(B -DKANJI=\"$B%3!<%I7O(B\" $B$r;XDj$7$^$9!#$3$N%3!<%I7O$O(B 2. $B$G;X(B
  118.    $BDj$9$k$b$N$HF1$8$G$9!#Nc$($P!"(B-DKANJI=\"euc\" $B$r(BFLAGSM $B$K@_Dj$9$k$H(B UNIX $B>e$N%U%!(B
  119.    $B%$%kL>$O!"(BEUC $B%3!<%I$K$J$j$^$9!#$3$3$G;XDj$7$?%3!<%I7O$O!"%5!<%P5Z$S%/%i%$%"%s%H(B
  120.    $B%W%m%0%i%`$N%G%U%)%k%H$KCM$J$j$^$9!#(B
  121.  
  122. -(2) JIS $B%3!<%IMQ%7%U%H%3!<%I(B
  123. -
  124. -  -DJIS_KSO=\'@\'    $B4A;z%3!<%I$N3+;O%7!<%1%s%9$r(B \E$@ $B$KJQ99$7$^$9!#(B
  125. -  -DJIS_KSI=\'B\'    $B4A;z%3!<%I$N=*N;%7!<%1%s%9$r(B \E(B $B$KJQ99$7$^$9!#(B
  126. -
  127. -  $B$N$h$&$K%G%U%)%k%H$N4A;z$N%7%U%H%3!<%I$rJQ99$9$k$3$H$,$G$-$^$9!#$3$N%7!<%1%s%9$O!"?7(B
  128. -  $B$7$$%U%!%$%k$r:n$k$H$-$J$I$KMQ$$$^$9!#(B
  129. -
  130.  3. $B@)8B;v9`(B
  131.  
  132.  (1) $B4A;z%3!<%I(B
  133. @@ -94,7 +104,13 @@
  134.    $B$A$c$s$H$7$?%9%Z%C%/$,$h$/$o$+$i$J$+$C$?$N$G$9$,!"0l1~!"(BDOS/V $B$NF0:n$HF1$8F0:n$r9T$J(B
  135.    $B$&$h$&$K$J$C$F$$$^$9!#(B
  136.  
  137. -4. $B$=$NB>(B
  138. +4. $B>c32Ey$N%l%]!<%H$K$D$$$F(B
  139. +
  140. +  $BF|K\8l$N%U%!%$%kL>$K4X$7$F!"J8;z2=$1Ey$N>c32$,$"$l$P!";d$K%l%]!<%H$7$FD:$1$l$P9,$$$G(B
  141. +$B$9!#$?$@$7!"%*%j%8%J%k$+$i$NLdBjE@$d<ALd$K$D$$$F$O!"%*%j%8%J%k$N:n<T$XD>@\Ld$$9g$o$;$k(B
  142. +$B$+!"$b$7$/$O%a!<%j%s%0%j%9%H$J$I$X%l%]!<%H$9$k$h$&$K$7$F2<$5$$!#(B
  143. +
  144. +5. $B$=$NB>(B
  145.  
  146.    hex $B7A<0$NJQ495Z$S(BUNIX $B>e$G$N%U%!%$%kL>$NJQ49J}K!$O!"(B
  147.  
  148. @@ -102,6 +118,7 @@
  149.  
  150.    $B$,:n$i$l$?%3!<%I$rMxMQ$7$F$$$^$9!#(B
  151.  
  152. -1994$BG/(B10$B7n(B28$BF|(B
  153. +1994$BG/(B10$B7n(B28$BF|(B $BBh#1HG(B
  154. +1995$BG/(B 8$B7n(B16$BF|(B $BBh#2HG(B
  155.  $BF#ED(B $B?r(B  fujita@ainix.isac.co.jp
  156.  
  157. diff -u -r --new-file last-version/docs/smb.conf.5 samba-1.9.14alpha17/docs/smb.conf.5
  158. --- last-version/docs/smb.conf.5    Tue Sep 12 22:57:45 1995
  159. +++ samba-1.9.14alpha17/docs/smb.conf.5    Thu Sep 14 09:57:46 1995
  160. @@ -1929,7 +1929,7 @@
  161.  
  162.  This options controls whether Samba will allow a previously validated
  163.  username/password pair to be used to attach to a share. Thus if you
  164. -connect to \\server\share1 then to \\server\share2 it won't
  165. +connect to \\\\server\\share1 then to \\\\server\\share2 it won't
  166.  automatically allow the client to request connection to the second
  167.  share as the same username as the first without a password.
  168.  
  169. @@ -2320,12 +2320,12 @@
  170.  You can have as many mappings as you like in a username map file.
  171.  
  172.  Note that the remapping is applied to all occurances of
  173. -usernames. Thus if you connect to "\\server\fred" and "fred" is
  174. +usernames. Thus if you connect to "\\\\server\\fred" and "fred" is
  175.  remapped to "mary" then you will actually be connecting to
  176. -"\\server\mary" and will need to supply a password suitable for "mary"
  177. -not "fred". The only exception to this is the username passwed to the
  178. -"password server" (if you have one). The password server will receive
  179. -whatever username the client supplies without modification.
  180. +"\\\\server\\mary" and will need to supply a password suitable for
  181. +"mary" not "fred". The only exception to this is the username passwed
  182. +to the "password server" (if you have one). The password server will
  183. +receive whatever username the client supplies without modification.
  184.  
  185.  Also note that no reverse mapping is done. The main effect this has is
  186.  with printing. Users who have been mapped may have trouble deleting
  187. diff -u -r --new-file last-version/source/Makefile samba-1.9.14alpha17/source/Makefile
  188. --- last-version/source/Makefile    Tue Sep 12 16:19:01 1995
  189. +++ samba-1.9.14alpha17/source/Makefile    Fri Sep 15 20:20:29 1995
  190. @@ -122,21 +122,17 @@
  191.  #####################################
  192.  # for the JAPANESE EXTENSION
  193.  # select filename's code set for KANJI/KANA in UNIX,
  194. -# apply apply following flag
  195. +# apply the following flag
  196.  #   -DKANJI=\"<code>\"
  197.  #        <code> is select character code set for JAPAN.
  198.  #             sjis:   if your machine support SJIS
  199.  #             euc:      if your machine support EUC
  200.  #             jis7:     if your machine support JIS7
  201. -#                     KANA:  SO = 0x0e, SI = 0x0f
  202. -#                       KANJI: SO = \E$B or \E$@, SI = \E(J or \E(B or \E(H
  203.  #             jis8:     if your machine support JIS8
  204. -#                       KANJI: SO = \E$B or \E$@, SI = \E(J or \E(B or \E(H
  205.  #             junet:    if your machine support jis7 + junet rule
  206. -#                     KANA:  SO = \E(I, SI = \E(J or \E(B or \E(H
  207. -#                       KANJI: SO = \E$B or \E$@, SI = \E(J or \E(B or \E(H
  208.  #             hex:      if your machine only support 7 bits ascii filename only
  209.  #                       convert to hexdecimal code preseeding ':'.
  210. +# see also README.jis
  211.  ######################################
  212.  
  213.  
  214. @@ -408,6 +404,10 @@
  215.  # FLAGSM= -DCONVEX -DSHADOW_PWD
  216.  # LIBSM= 
  217.  
  218. +# This is for SMP_DC.OSx v1.1-94c079 on Pyramid S series
  219. +# contributed by jeffrey@itm.org
  220. +# FLAGSM = -DSOLARIS -DSHADOW_PWD -DBSD_COMP
  221. +# LIBSM = -lsocket -lnsl
  222.  
  223.  
  224.  ######################################################################
  225. diff -u -r --new-file last-version/source/change-log samba-1.9.14alpha17/source/change-log
  226. --- last-version/source/change-log    Thu Sep 14 00:11:34 1995
  227. +++ samba-1.9.14alpha17/source/change-log    Fri Sep 15 21:40:11 1995
  228. @@ -1554,7 +1554,28 @@
  229.      - fixed fcb open permissions (should mean apps know when a file is
  230.      read only)
  231.      - released alpha16
  232. +    - client help formatting fix and docs fix from Peter Jones
  233. +    <thanatos@drealm.org>
  234. +    - added a directory cache
  235. +    - use /proc whenever possible for pid detection
  236. +    - TCSANOW fix in getsmbpasswd from roderich@nodebonn.muc.bmw.de
  237. +    - fixed default printing mode for sysv systems
  238. +    - make client always expand mask
  239. +    - more minor IPC fixups
  240. +    - pyramid makefile entry from jeffrey@itm.org
  241. +    - client fixups for passlen, maxvcs and session redirect from
  242. +    Charles Hoch <hoch@hplcgh.hpl.hp.com>
  243. +    - finally fixed important IPC bug (varargs bug with int16)
  244. +    - quota patches from Dirk.DeWachter@rug.ac.be
  245. +    - print queue cache changes (per service) and print queue priority
  246. +    additions from Dirk.DeWachter@rug.ac.be
  247. +    - new japanese patches (incomplete) from 
  248. +    fujita@ainix.isac.co.jp (Takashi Fujita)
  249. +    - moved a lot more functions into system.c via wrappers
  250. +    - changed a lot of the connection refused error codes to be more
  251. +    informative (or at least different)
  252.  
  253. +
  254.  ==========
  255.  todo:
  256.  
  257. @@ -1584,6 +1605,8 @@
  258.  get rid of the silly +4 and -4 by removing NBT stuff
  259.  
  260.  write-only shares
  261. +
  262. +document cnvchar stuff
  263.  
  264.  UNRESOLVED PROBLEMS
  265.  ===================
  266. diff -u -r --new-file last-version/source/client.c samba-1.9.14alpha17/source/client.c
  267. --- last-version/source/client.c    Wed Sep 13 22:47:45 1995
  268. +++ samba-1.9.14alpha17/source/client.c    Fri Sep 15 21:05:13 1995
  269. @@ -113,8 +113,8 @@
  270.  
  271.  #ifdef KANJI
  272.  extern int coding_system;
  273. -#define CNV_LANG(s) (coding_system == DOSV_CODE?s:kj_unix_format(s, False))
  274. -#define CNV_INPUT(s) (coding_system == DOSV_CODE?s:kj_dos_format(s, True))
  275. +#define CNV_LANG(s) (coding_system == DOSV_CODE?s:dos_to_unix(s, False))
  276. +#define CNV_INPUT(s) (coding_system == DOSV_CODE?s:unix_to_dos(s, True))
  277.  static BOOL
  278.  setup_term_code (char *code)
  279.  {
  280. @@ -936,8 +936,7 @@
  281.        strcat(mask,"*");
  282.    }
  283.  
  284. -  if (Protocol < PROTOCOL_LANMAN2)
  285. -    expand_mask(mask,True);
  286. +  expand_mask(mask,True);
  287.    do_dir(inbuf,outbuf,mask,attribute,NULL,recurse);
  288.  
  289.    do_dskattr();
  290. @@ -1426,7 +1425,7 @@
  291.      if (lowercase)
  292.        strlower(finfo->name);
  293.  
  294. -    if (!directory_exist(finfo->name) && mkdir(finfo->name,0777) != 0) 
  295. +    if (!directory_exist(finfo->name) && sys_mkdir(finfo->name,0777) != 0) 
  296.        {
  297.          DEBUG(0,("failed to create directory %s\n",CNV_LANG(finfo->name)));
  298.          strcpy(cur_dir,saved_curdir);
  299. @@ -1434,7 +1433,7 @@
  300.          return;
  301.        }
  302.  
  303. -    if (chdir(finfo->name) != 0)
  304. +    if (sys_chdir(finfo->name) != 0)
  305.        {
  306.          DEBUG(0,("failed to chdir to directory %s\n",CNV_LANG(finfo->name)));
  307.          strcpy(cur_dir,saved_curdir);
  308. @@ -2424,7 +2423,7 @@
  309.    struct stat sbuf;
  310.  
  311.    ok = next_token(NULL,buf,NULL);
  312. -  if (ok && (stat(buf,&sbuf) == 0))
  313. +  if (ok && (sys_stat(buf,&sbuf) == 0))
  314.      {
  315.        newer_than = sbuf.st_mtime + GMT_TO_LOCAL*TimeDiff(sbuf.st_mtime);
  316.        DEBUG(1,("Getting files newer than %s",asctime(LocalTime(&newer_than,0))));
  317. @@ -2527,7 +2526,7 @@
  318.    pstring d;
  319.  
  320.    if (next_token(NULL,buf,NULL))
  321. -    chdir(buf);
  322. +    sys_chdir(buf);
  323.    DEBUG(2,("the local directory is now %s\n",GetWd(d)));
  324.  }
  325.  
  326. @@ -2559,12 +2558,43 @@
  327.    DEBUG(5,("Sent session request\n"));
  328.  
  329.    receive_smb(inbuf,CLIENT_TIMEOUT);
  330. +
  331. +  if (CVAL(inbuf,0) == 0x84) /* C. Hoch  9/14/95 Start */
  332. +    {
  333. +      /* For information, here is the response structure.
  334. +       * We do the byte-twiddling to for portability.
  335. +       struct RetargetResponse{
  336. +       unsigned char type;
  337. +       unsigned char flags;
  338. +       int16 length;
  339. +       int32 ip_addr;
  340. +       int16 port;
  341. +       };
  342. +       */
  343. +      extern int Client;
  344. +      int port = (CVAL(inbuf,8)<<8)+CVAL(inbuf,9);
  345. +      /* SESSION RETARGET */
  346. +      putip((char *)&dest_ip,inbuf+4);
  347. +
  348. +      close_sockets();
  349. +      Client = open_socket_out(&dest_ip, port);
  350. +      if (Client == -1)
  351. +        return False;
  352. +
  353. +      DEBUG(3,("Retargeted\n"));
  354. +
  355. +      set_socket_options(Client,user_socket_options);
  356. +
  357. +      /* Try again */
  358. +      return send_session_request(inbuf,outbuf);
  359. +    } /* C. Hoch 9/14/95 End */
  360. +
  361. +
  362.    if (CVAL(inbuf,0) != 0x82)
  363.      {
  364.        int ecode = CVAL(inbuf,4);
  365.        DEBUG(0,("Session request failed (%d,%d) with myname=%s destname=%s\n",
  366. -        CVAL(inbuf,0),ecode,myname,desthost));
  367. +           CVAL(inbuf,0),ecode,myname,desthost));
  368.        switch (ecode)
  369.      {
  370.      case 0x80: 
  371. @@ -2608,6 +2638,7 @@
  372.    extern int serverzone;
  373.    int sec_mode=0;
  374.    int crypt_len;
  375. +  int max_vcs=0;
  376.    struct {
  377.      int prot;
  378.      char *name;
  379. @@ -2715,7 +2746,8 @@
  380.      crypt_len = smb_buflen(inbuf);
  381.      memcpy(cryptkey,smb_buf(inbuf),8);
  382.      DEBUG(3,("max mux %d\n",SVAL(inbuf,smb_vwv3)));
  383. -    DEBUG(3,("max vcs %d\n",SVAL(inbuf,smb_vwv4)));
  384. +    max_vcs = SVAL(inbuf,smb_vwv4); 
  385. +    DEBUG(3,("max vcs %d\n",max_vcs)); 
  386.      DEBUG(3,("max blk %d\n",SVAL(inbuf,smb_vwv5)));
  387.    } else {
  388.      /* NT protocol */
  389. @@ -2730,7 +2762,8 @@
  390.      if (IVAL(inbuf,smb_vwv9+1) & 1)
  391.        readbraw_supported = writebraw_supported = True;      
  392.      DEBUG(3,("max mux %d\n",SVAL(inbuf,smb_vwv1+1)));
  393. -    DEBUG(3,("max vcs %d\n",SVAL(inbuf,smb_vwv2+1)));
  394. +    max_vcs = SVAL(inbuf,smb_vwv2+1); 
  395. +    DEBUG(3,("max vcs %d\n",max_vcs));
  396.      DEBUG(3,("max raw %d\n",IVAL(inbuf,smb_vwv5+1)));
  397.      DEBUG(3,("capabilities 0x%x\n",IVAL(inbuf,smb_vwv9+1)));
  398.    }
  399. @@ -2776,7 +2809,7 @@
  400.  #endif
  401.  
  402.        /* if in share level security then don't send a password now */
  403. -      if (!(sec_mode & 1)) passlen=0;
  404. +      if (!(sec_mode & 1)) {strcpy(pword, "");passlen=1;} 
  405.  
  406.        /* send a session setup command */
  407.        bzero(outbuf,smb_size);
  408. @@ -2789,7 +2822,7 @@
  409.      CVAL(outbuf,smb_vwv0) = 0xFF;
  410.      SSVAL(outbuf,smb_vwv2,max_xmit);
  411.      SSVAL(outbuf,smb_vwv3,2);
  412. -    SSVAL(outbuf,smb_vwv4,getpid());
  413. +    SSVAL(outbuf,smb_vwv4,max_vcs-1);
  414.      SIVAL(outbuf,smb_vwv5,sesskey);
  415.      SSVAL(outbuf,smb_vwv7,passlen);
  416.      p = smb_buf(outbuf);
  417. @@ -2880,7 +2913,7 @@
  418.   again2:
  419.  
  420.    {
  421. -    int passlen = strlen(pass);
  422. +    int passlen = strlen(pass)+1;
  423.      fstring pword;
  424.      strcpy(pword,pass);
  425.  
  426. @@ -2893,7 +2926,7 @@
  427.  
  428.      /* if in user level security then don't send a password now */
  429.      if ((sec_mode & 1)) {
  430. -      passlen=0;
  431. +      strcpy(pword, ""); passlen=1; 
  432.      }
  433.  
  434.      set_message(outbuf,4,2 + strlen(service) + passlen + strlen(dev),True);
  435. @@ -3301,7 +3334,7 @@
  436.  ****************************************************************************/
  437.  void cmd_help(void)
  438.  {
  439. -  int i=0;
  440. +  int i=0,j;
  441.    fstring buf;
  442.  
  443.    if (next_token(NULL,buf,NULL))
  444. @@ -3316,8 +3349,11 @@
  445.    else
  446.      while (commands[i].description)
  447.        {
  448. -    DEBUG(0,("%s\n",commands[i].name));
  449. -    i++;
  450. +    for (j=0; commands[i].description && (j<5); j++) {
  451. +      DEBUG(0,("%-15s",commands[i].name));
  452. +      i++;
  453. +    }
  454. +    DEBUG(0,("\n"));
  455.        }
  456.  }
  457.  
  458. diff -u -r --new-file last-version/source/clitar.c samba-1.9.14alpha17/source/clitar.c
  459. --- last-version/source/clitar.c    Fri Jul  7 15:13:34 1995
  460. +++ samba-1.9.14alpha17/source/clitar.c    Fri Sep 15 20:24:05 1995
  461. @@ -207,8 +207,27 @@
  462.     * to lovely unix /'s :-} */
  463.  
  464.    *tptr++='.';
  465. -
  466. +#ifdef KANJI
  467. +  while (l > 0) {
  468. +    if (is_shift_jis (*fp)) {
  469. +      *tptr++ = *fp++;
  470. +      *tptr++ = *fp++;
  471. +      l -= 2;
  472. +    } else if (is_kana (*fp)) {
  473. +      *tptr++ = *fp++;
  474. +      l--;
  475. +    } else if (*fp == '\\') {
  476. +      *tptr++ = '/';
  477. +      fp++;
  478. +      l--;
  479. +    } else {
  480. +      *tptr++ = *fp++;
  481. +      l--;
  482. +    }
  483. +  }
  484. +#else
  485.    while (l--) { *tptr=(*fp == '\\') ? '/' : *fp; tptr++; fp++; }
  486. +#endif
  487.  }
  488.  
  489.  static void oct_it (register long value, register int ndgs, register char *p)
  490. @@ -846,7 +865,27 @@
  491.    if (*fp == '.') fp++;
  492.    if (*fp == '\\' || *fp == '/') fp++;
  493.  
  494. +#ifdef KANJI
  495. +  while (l > 0) {
  496. +    if (is_shift_jis (*fp)) {
  497. +      *tptr++ = *fp++;
  498. +      *tptr++ = *fp++;
  499. +      l -= 2;
  500. +    } else if (is_kana (*fp)) {
  501. +      *tptr++ = *fp++;
  502. +      l--;
  503. +    } else if (*fp == '/') {
  504. +      *tptr++ = '\\';
  505. +      fp++;
  506. +      l--;
  507. +    } else {
  508. +      *tptr++ = *fp++;
  509. +      l--;
  510. +    }
  511. +  }
  512. +#else
  513.    while (l--) { *tptr=(*fp == '/') ? '\\' : *fp; tptr++; fp++; }
  514. +#endif
  515.  }
  516.  
  517.  static long unoct(char *p, int ndgs)
  518. diff -u -r --new-file last-version/source/dir.c samba-1.9.14alpha17/source/dir.c
  519. --- last-version/source/dir.c    Wed Sep 13 22:30:27 1995
  520. +++ samba-1.9.14alpha17/source/dir.c    Fri Sep 15 20:59:45 1995
  521. @@ -449,7 +449,7 @@
  522.        strcpy(pathreal,path);
  523.        strcat(path,fname);
  524.        strcat(pathreal,dname);
  525. -      if (stat(pathreal,&sbuf) != 0) 
  526. +      if (sys_stat(pathreal,&sbuf) != 0) 
  527.          {
  528.            DEBUG(5,("Couldn't stat 1 [%s]\n",path));
  529.            continue;
  530. @@ -497,7 +497,7 @@
  531.  {
  532.    Dir *dirp;
  533.    char *n;
  534. -  void *p = opendir(name);
  535. +  void *p = sys_opendir(name);
  536.    int used=0;
  537.  
  538.    if (!p) return(NULL);
  539. @@ -597,6 +597,89 @@
  540.  }
  541.  
  542.  
  543. +static int dir_cache_size = 0;
  544. +static struct dir_cache {
  545. +  struct dir_cache *next;
  546. +  struct dir_cache *prev;
  547. +  char *path;
  548. +  char *name;
  549. +  char *dname;
  550. +  int snum;
  551. +} *dir_cache = NULL;
  552. +
  553. +/*******************************************************************
  554. +add an entry to the directory cache
  555. +********************************************************************/
  556. +void DirCacheAdd(char *path,char *name,char *dname,int snum)
  557. +{
  558. +  struct dir_cache *entry = (struct dir_cache *)malloc(sizeof(*entry));
  559. +  if (!entry) return;
  560. +  entry->path = strdup(path);
  561. +  entry->name = strdup(name);
  562. +  entry->dname = strdup(dname);
  563. +  entry->snum = snum;
  564. +  if (!entry->path || !entry->name || !entry->dname) return;
  565. +
  566. +  entry->next = dir_cache;
  567. +  entry->prev = NULL;
  568. +  if (entry->next) entry->next->prev = entry;
  569. +  dir_cache = entry;
  570. +
  571. +  DEBUG(1,("Added dir cache entry %s %s -> %s\n",path,name,dname));
  572. +  
  573. +  if (dir_cache_size == DIRCACHESIZE) {
  574. +    for (entry=dir_cache; entry->next; entry=entry->next) ;
  575. +    free(entry->path);
  576. +    free(entry->name);
  577. +    free(entry->dname);
  578. +    if (entry->prev) entry->prev->next = entry->next;
  579. +    free(entry);
  580. +  } else {
  581. +    dir_cache_size++;
  582. +  }
  583. +}
  584. +
  585. +
  586. +/*******************************************************************
  587. +check for an entry in the directory cache
  588. +********************************************************************/
  589. +char *DirCacheCheck(char *path,char *name,int snum)
  590. +{
  591. +  struct dir_cache *entry;
  592. +
  593. +  for (entry=dir_cache; entry; entry=entry->next) {
  594. +    if (entry->snum == snum &&
  595. +    strcmp(path,entry->path) == 0 &&
  596. +    strcmp(name,entry->name) == 0) {
  597. +      DEBUG(1,("Got dir cache hit on %s %s -> %s\n",path,name,entry->dname));
  598. +      return(entry->dname);
  599. +    }
  600. +  }
  601. +
  602. +  return(NULL);
  603. +}
  604. +
  605. +/*******************************************************************
  606. +flush entries in the dir_cache
  607. +********************************************************************/
  608. +void DirCacheFlush(int snum)
  609. +{
  610. +  struct dir_cache *entry,*next;
  611. +
  612. +  for (entry=dir_cache; entry; entry=next) {
  613. +    if (entry->snum == snum) {
  614. +      free(entry->path);
  615. +      free(entry->dname);
  616. +      free(entry->name);
  617. +      next = entry->next;
  618. +      if (entry->prev) entry->prev->next = entry->next;
  619. +      if (entry->next) entry->next->prev = entry->prev;
  620. +      free(entry);
  621. +    } else {
  622. +      next = entry->next;
  623. +    }
  624. +  }
  625. +}
  626.  
  627.  
  628.  #ifdef REPLACE_GETWD
  629. diff -u -r --new-file last-version/source/getsmbpass.c samba-1.9.14alpha17/source/getsmbpass.c
  630. --- last-version/source/getsmbpass.c    Sun Sep 10 23:28:46 1995
  631. +++ samba-1.9.14alpha17/source/getsmbpass.c    Thu Sep 14 12:25:43 1995
  632. @@ -46,6 +46,10 @@
  633.  #define TCSAFLUSH 1
  634.  #endif
  635.  
  636. +#ifndef TCSANOW
  637. +#define TCSANOW 0
  638. +#endif
  639. +
  640.  int tcgetattr(int fd, struct termio *t)
  641.  {
  642.      return ioctl(fd, TCGETA, t);
  643. @@ -148,7 +152,7 @@
  644.  
  645.    /* Restore echoing.  */
  646.    if (echo_off)
  647. -    (void) tcsetattr (fileno (in), 0, &t);
  648. +    (void) tcsetattr (fileno (in), TCSANOW, &t);
  649.  
  650.    if (in != stdin)
  651.      /* We opened the terminal; now close it.  */
  652. diff -u -r --new-file last-version/source/includes.h samba-1.9.14alpha17/source/includes.h
  653. --- last-version/source/includes.h    Tue Sep 12 16:21:44 1995
  654. +++ samba-1.9.14alpha17/source/includes.h    Fri Sep 15 20:28:21 1995
  655. @@ -67,6 +67,7 @@
  656.  #define NO_NETIFH
  657.  #define NO_RESOURCEH
  658.  #define PRIME_NMBD 0
  659. +#define NO_SETGROUPS
  660.  #endif
  661.  
  662.  
  663. @@ -251,7 +252,6 @@
  664.  #define REPLACE_STRLEN
  665.  #define USE_STATVFS
  666.  #define USE_GETCWD
  667. -#define DEFAULT_PRINTING PRINT_SYSV
  668.  #define USE_SETSID
  669.  #endif
  670.  
  671. @@ -278,7 +278,9 @@
  672.  #include <sys/statfs.h>
  673.  #include <string.h>
  674.  #include <signal.h>
  675. +#ifndef SYSV
  676.  #define SYSV
  677. +#endif
  678.  #define SIGNAL_CAST (void (*)())
  679.  #define STATFS4
  680.  #define USE_WAITPID
  681. @@ -352,7 +354,6 @@
  682.  #define SIGNAL_CAST (void (*)(int))
  683.  #define USE_STATVFS
  684.  #define USE_GETCWD
  685. -#define DEFAULT_PRINTING PRINT_SYSV
  686.  #endif
  687.  
  688.  
  689. @@ -646,7 +647,6 @@
  690.  char *strdup (char *);
  691.  #define USE_GETCWD
  692.  #define NO_FSYNC
  693. -#define DEFAULT_PRINTING PRINT_SYSV
  694.  #define NO_EID
  695.  #endif
  696.  
  697. @@ -769,6 +769,8 @@
  698.  #define GID_TYPE gid_t
  699.  #endif
  700.  
  701. +
  702. +
  703.  /* some unixes have ENOTTY instead of TIOCNOTTY */
  704.  #ifndef TIOCNOTTY
  705.  #ifdef ENOTTY
  706. @@ -780,10 +782,14 @@
  707.  #define SIGHUP 1
  708.  #endif
  709.  
  710. -/* if undefined then use bsd printing */
  711. +/* if undefined then use bsd or sysv printing */
  712.  #ifndef DEFAULT_PRINTING
  713. +#ifdef SYSV
  714. +#define DEFAULT_PRINTING PRINT_SYSV
  715. +#else
  716.  #define DEFAULT_PRINTING PRINT_BSD
  717.  #endif
  718. +#endif
  719.  
  720.  
  721.  #ifdef AFS_AUTH
  722. @@ -825,12 +831,7 @@
  723.  #include "smbpass.h"
  724.  #endif
  725.  
  726. -#ifdef KANJI
  727. -#ifndef _KANJI_C_
  728.  #include "kanji.h"
  729. -#endif /* _KANJI_C_ */
  730. -#endif /* KANJI */
  731. -
  732.  #include "charset.h"
  733.  
  734.  #ifndef S_IFREG
  735. diff -u -r --new-file last-version/source/ipc.c samba-1.9.14alpha17/source/ipc.c
  736. --- last-version/source/ipc.c    Tue Sep 12 15:02:10 1995
  737. +++ samba-1.9.14alpha17/source/ipc.c    Fri Sep 15 18:18:44 1995
  738. @@ -37,7 +37,6 @@
  739.  extern files_struct Files[];
  740.  
  741.  extern fstring local_machine;
  742. -extern BOOL lpq_cache_reset;
  743.  
  744.  #define NERR_Success 0
  745.  #define NERR_badpass 86
  746. @@ -207,7 +206,7 @@
  747.  static int get_counter(char** p)
  748.  {
  749.    int i, n;
  750. -  if (!p || !(*p)) return(0);
  751. +  if (!p || !(*p)) return(1);
  752.    if (!isdigit(**p)) return 1;
  753.    for (n = 0;;) {
  754.      i = **p;
  755. @@ -302,7 +301,7 @@
  756.        p->curpos = p->format;
  757.      else {
  758.        p->curpos = p->subformat;
  759. -      if (p->subcount) p->subcount--;
  760. +      p->subcount--;
  761.      }
  762.    }
  763.  #if CHECK_TYPES
  764. @@ -324,22 +323,25 @@
  765.    switch( *p->curpos++ ) {
  766.    case 'W':            /* word (2 byte) */
  767.      needed = 2;
  768. -    temp = va_arg(args,int16);
  769. +    temp = va_arg(args,int);
  770.      if (p->buflen >= needed) SSVAL(p->structbuf,0,temp);
  771.      break;
  772.    case 'N':            /* count of substructures (word) at end */
  773.      needed = 2;
  774. -    p->subcount = va_arg(args,int16);
  775. +    p->subcount = va_arg(args,int);
  776.      if (p->buflen >= needed) SSVAL(p->structbuf,0,p->subcount);
  777.      break;
  778.    case 'D':            /* double word (4 byte) */
  779.      needed = 4;
  780. -    temp = va_arg(args,int32);
  781. +    temp = va_arg(args,int);
  782.      if (p->buflen >= needed) SIVAL(p->structbuf,0,temp);
  783.      break;
  784.    case 'B':            /* byte (with optional counter) */
  785.      needed = get_counter(&p->curpos);
  786. -    if (p->buflen >= needed) StrnCpy(p->structbuf,va_arg(args,char*),needed);
  787. +    {
  788. +      char *s = va_arg(args,char*);
  789. +      if (p->buflen >= needed) StrnCpy(p->structbuf,s?s:"",needed);
  790. +    }
  791.      break;
  792.    case 'z':            /* offset to zero terminated string (4 byte) */
  793.      str = va_arg(args,char*);
  794. @@ -370,7 +372,7 @@
  795.      SIVAL(p->structbuf,0,0);
  796.        else {
  797.      SIVAL(p->structbuf,0,PTR_DIFF(p->stringbuf,p->base));
  798. -    memcpy(p->stringbuf,str,stringused);
  799. +    memcpy(p->stringbuf,str?str:"",stringused);
  800.      if (is_string) p->stringbuf[stringused-1] = '\0';
  801.      p->stringbuf += stringused;
  802.      p->stringlen -= stringused;
  803. @@ -399,6 +401,17 @@
  804.  #define PACKl(desc,t,v,l) package(desc,v,l)
  805.  #endif
  806.  
  807. +static void PACKI(struct pack_desc* desc,char *t,int v)
  808. +{
  809. +  PACK(desc,t,v);
  810. +}
  811. +
  812. +static void PACKS(struct pack_desc* desc,char *t,char *v)
  813. +{
  814. +  PACK(desc,t,v);
  815. +}
  816. +
  817. +
  818.  static void PackDriverData(struct pack_desc* desc)
  819.  {
  820.    char drivdata[4+4+32];
  821. @@ -445,40 +458,40 @@
  822.                     struct pack_desc* desc,
  823.                     print_queue_struct* queue, int n)
  824.  {
  825. -  PACK(desc,"W",((snum%0xFF)<<8) | (queue->job%0xFF)); /* uJobId */
  826. +  PACKI(desc,"W",((snum%0xFF)<<8) | (queue->job%0xFF)); /* uJobId */
  827.    if (uLevel == 1) {
  828. -    PACK(desc,"B21",queue->user); /* szUserName */
  829. -    PACK(desc,"B","");        /* pad */
  830. -    PACK(desc,"B16","");    /* szNotifyName */
  831. -    PACK(desc,"B10","PM_Q_RAW"); /* szDataType */
  832. -    PACK(desc,"z","");        /* pszParms */
  833. -    PACK(desc,"W",n+1);        /* uPosition */
  834. -    PACK(desc,"W",queue->status); /* fsStatus */
  835. -    PACK(desc,"z","");        /* pszStatus */
  836. -    PACK(desc,"D",queue->time); /* ulSubmitted */
  837. -    PACK(desc,"D",queue->size); /* ulSize */
  838. -    PACK(desc,"z",queue->file); /* pszComment */
  839. +    PACKS(desc,"B21",queue->user); /* szUserName */
  840. +    PACKS(desc,"B","");        /* pad */
  841. +    PACKS(desc,"B16","");    /* szNotifyName */
  842. +    PACKS(desc,"B10","PM_Q_RAW"); /* szDataType */
  843. +    PACKS(desc,"z","");        /* pszParms */
  844. +    PACKI(desc,"W",n+1);        /* uPosition */
  845. +    PACKI(desc,"W",queue->status); /* fsStatus */
  846. +    PACKS(desc,"z","");        /* pszStatus */
  847. +    PACKI(desc,"D",queue->time); /* ulSubmitted */
  848. +    PACKI(desc,"D",queue->size); /* ulSize */
  849. +    PACKS(desc,"z",queue->file); /* pszComment */
  850.    }
  851.    if (uLevel == 2 || uLevel == 3) {
  852. -    PACK(desc,"W",50);        /* uPriority */
  853. -    PACK(desc,"z",queue->user); /* pszUserName */
  854. -    PACK(desc,"W",n+1);        /* uPosition */
  855. -    PACK(desc,"W",queue->status); /* fsStatus */
  856. -    PACK(desc,"D",queue->time); /* ulSubmitted */
  857. -    PACK(desc,"D",queue->size); /* ulSize */
  858. -    PACK(desc,"z","Samba");    /* pszComment */
  859. -    PACK(desc,"z",queue->file); /* pszDocument */
  860. +    PACKI(desc,"W",queue->priority);        /* uPriority */
  861. +    PACKS(desc,"z",queue->user); /* pszUserName */
  862. +    PACKI(desc,"W",n+1);        /* uPosition */
  863. +    PACKI(desc,"W",queue->status); /* fsStatus */
  864. +    PACKI(desc,"D",queue->time); /* ulSubmitted */
  865. +    PACKI(desc,"D",queue->size); /* ulSize */
  866. +    PACKS(desc,"z","Samba");    /* pszComment */
  867. +    PACKS(desc,"z",queue->file); /* pszDocument */
  868.      if (uLevel == 3) {
  869. -      PACK(desc,"z","");    /* pszNotifyName */
  870. -      PACK(desc,"z","PM_Q_RAW"); /* pszDataType */
  871. -      PACK(desc,"z","");    /* pszParms */
  872. -      PACK(desc,"z","");    /* pszStatus */
  873. -      PACK(desc,"z",SERVICE(snum)); /* pszQueue */
  874. -      PACK(desc,"z","lpd");    /* pszQProcName */
  875. -      PACK(desc,"z","");    /* pszQProcParms */
  876. -      PACK(desc,"z","NULL"); /* pszDriverName */
  877. +      PACKS(desc,"z","");    /* pszNotifyName */
  878. +      PACKS(desc,"z","PM_Q_RAW"); /* pszDataType */
  879. +      PACKS(desc,"z","");    /* pszParms */
  880. +      PACKS(desc,"z","");    /* pszStatus */
  881. +      PACKS(desc,"z",SERVICE(snum)); /* pszQueue */
  882. +      PACKS(desc,"z","lpd");    /* pszQProcName */
  883. +      PACKS(desc,"z","");    /* pszQProcParms */
  884. +      PACKS(desc,"z","NULL"); /* pszDriverName */
  885.        PackDriverData(desc);    /* pDriverData */
  886. -      PACK(desc,"z","");    /* pszPrinterName */
  887. +      PACKS(desc,"z","");    /* pszPrinterName */
  888.      }
  889.    }
  890.  }
  891. @@ -488,52 +501,51 @@
  892.                    int count, print_queue_struct* queue,
  893.                    print_status_struct* status)
  894.  {
  895. -  if (uLevel < 3)
  896. -    PACK(desc,"B13",SERVICE(snum));
  897. -  else
  898. -    PACK(desc,"z",Expand(cnum,snum,SERVICE(snum)));
  899. +  if (uLevel < 3) {
  900. +    PACKS(desc,"B13",SERVICE(snum));
  901. +  } else {
  902. +    PACKS(desc,"z",Expand(cnum,snum,SERVICE(snum)));
  903. +  }
  904.    if (uLevel == 1 || uLevel == 2) {
  905. -    PACK(desc,"B","");        /* alignment */
  906. -    PACK(desc,"W",5);        /* priority */
  907. -    PACK(desc,"W",0);        /* start time */
  908. -    PACK(desc,"W",0);        /* until time */
  909. -    PACK(desc,"z","");        /* pSepFile */
  910. -    PACK(desc,"z","lpd");    /* pPrProc */
  911. -    PACK(desc,"z",SERVICE(snum)); /* pDestinations */
  912. -    PACK(desc,"z",0);        /* pParms */
  913. +    PACKS(desc,"B","");        /* alignment */
  914. +    PACKI(desc,"W",5);        /* priority */
  915. +    PACKI(desc,"W",0);        /* start time */
  916. +    PACKI(desc,"W",0);        /* until time */
  917. +    PACKS(desc,"z","");        /* pSepFile */
  918. +    PACKS(desc,"z","lpd");    /* pPrProc */
  919. +    PACKS(desc,"z",SERVICE(snum)); /* pDestinations */
  920. +    PACKS(desc,"z","");        /* pParms */
  921.      if (snum < 0) {
  922. -      PACK(desc,"z","UNKNOWN PRINTER");
  923. -      PACK(desc,"W",LPSTAT_ERROR);
  924. -    }
  925. -    else if (!status->message[0]) {
  926. -      PACK(desc,"z",Expand(cnum,snum,lp_comment(snum)));
  927. -      PACK(desc,"W",LPSTAT_OK); /* status */
  928. +      PACKS(desc,"z","UNKNOWN PRINTER");
  929. +      PACKI(desc,"W",LPSTAT_ERROR);
  930.      }
  931. -    else {
  932. -      PACK(desc,"z",status->message);
  933. -      PACK(desc,"W",status->status); /* status */
  934. +    else if (!status || !status->message[0]) {
  935. +      PACKS(desc,"z",Expand(cnum,snum,lp_comment(snum)));
  936. +      PACKI(desc,"W",LPSTAT_OK); /* status */
  937. +    } else {
  938. +      PACKS(desc,"z",status->message);
  939. +      PACKI(desc,"W",status->status); /* status */
  940.      }
  941. -    PACK(desc,(uLevel == 1 ? "W" : "N"),count);
  942. +    PACKI(desc,(uLevel == 1 ? "W" : "N"),count);
  943.    }
  944.    if (uLevel == 3 || uLevel == 4) {
  945. -    PACK(desc,"W",5);        /* uPriority */
  946. -    PACK(desc,"W",0);        /* uStarttime */
  947. -    PACK(desc,"W",0);        /* uUntiltime */
  948. -    PACK(desc,"W",5);        /* pad1 */
  949. -    PACK(desc,"z","");        /* pszSepFile */
  950. -    PACK(desc,"z","lpd");    /* pszPrProc */
  951. -    PACK(desc,"z","");        /* pszParms */
  952. -    if (!status->message[0]) {
  953. -      PACK(desc,"z",Expand(cnum,snum,lp_comment(snum))); /* pszComment */
  954. -      PACK(desc,"W",LPSTAT_OK); /* fsStatus */
  955. -    }
  956. -    else {
  957. -      PACK(desc,"z",status->message); /* pszComment */
  958. -      PACK(desc,"W",status->status); /* fsStatus */
  959. -    }
  960. -    PACK(desc,(uLevel == 3 ? "W" : "N"),count);    /* cJobs */
  961. -    PACK(desc,"z",SERVICE(snum)); /* pszPrinters */
  962. -    PACK(desc,"z","NULL");    /* pszDriverName */
  963. +    PACKI(desc,"W",5);        /* uPriority */
  964. +    PACKI(desc,"W",0);        /* uStarttime */
  965. +    PACKI(desc,"W",0);        /* uUntiltime */
  966. +    PACKI(desc,"W",5);        /* pad1 */
  967. +    PACKS(desc,"z","");        /* pszSepFile */
  968. +    PACKS(desc,"z","lpd");    /* pszPrProc */
  969. +    PACKS(desc,"z","");        /* pszParms */
  970. +    if (!status || !status->message[0]) {
  971. +      PACKS(desc,"z",Expand(cnum,snum,lp_comment(snum))); /* pszComment */
  972. +      PACKI(desc,"W",LPSTAT_OK); /* fsStatus */
  973. +    } else {
  974. +      PACKS(desc,"z",status->message); /* pszComment */
  975. +      PACKI(desc,"W",status->status); /* fsStatus */
  976. +    }
  977. +    PACKI(desc,(uLevel == 3 ? "W" : "N"),count);    /* cJobs */
  978. +    PACKS(desc,"z",SERVICE(snum)); /* pszPrinters */
  979. +    PACKS(desc,"z","NULL");    /* pszDriverName */
  980.      PackDriverData(desc);    /* pDriverData */
  981.    }
  982.    if (uLevel == 2 || uLevel == 4) {
  983. @@ -1001,14 +1013,15 @@
  984.                  char **rdata,char **rparam,
  985.                  int *rdata_len,int *rparam_len)
  986.  {
  987. +  int function = SVAL(param,0);
  988.    char *str1 = param+2;
  989.    char *str2 = skip_string(str1,1);
  990.    char *p = skip_string(str2,1);
  991.    int jobid = (SVAL(p,0)&0xFF); /* the snum and jobid are encoded
  992.                     by the print queue api */
  993.    int snum = (SVAL(p,0)>>8);  
  994. +  int i, count;
  995.  
  996. -  lpq_cache_reset = True;
  997.  
  998.    /* check it's a supported varient */
  999.    if (!(strcsequal(str1,"W") && strcsequal(str2,"")))
  1000. @@ -1020,25 +1033,39 @@
  1001.    *rdata_len = 0;
  1002.  
  1003.    SSVAL(*rparam,0,NERR_Success);
  1004. -  SSVAL(*rparam,2,0);        /* converter word */
  1005.  
  1006.    if (snum >= 0)
  1007.      {
  1008.        print_queue_struct *queue=NULL;
  1009. -      int i;
  1010. -      int count = get_printqueue(snum,cnum,&queue,NULL);
  1011. -
  1012. +      lpq_reset(snum);
  1013. +      count = get_printqueue(snum,cnum,&queue,NULL);
  1014. +  
  1015.        for (i=0;i<count;i++)
  1016. -    if ((queue[i].job%0xFF) == jobid)
  1017. -      {
  1018. -        DEBUG(3,("Deleting queue entry %d\n",queue[i].job));
  1019. -        del_printqueue(cnum,snum,queue[i].job);
  1020. -      }
  1021. +      if ((queue[i].job%0xFF) == jobid)
  1022. +        {
  1023. +         switch (function) {
  1024. +        case 81:        /* delete */ 
  1025. +          DEBUG(3,("Deleting queue entry %d\n",queue[i].job));
  1026. +          del_printqueue(cnum,snum,queue[i].job);
  1027. +          break;
  1028. +        case 82:        /* pause */
  1029. +        case 83:        /* resume */
  1030. +          DEBUG(3,("%s queue entry %d\n",
  1031. +               (function==82?"pausing":"resuming"),queue[i].job));
  1032. +          status_printjob(cnum,snum,queue[i].job,
  1033. +                  (function==82?LPQ_PAUSED:LPQ_QUEUED));
  1034. +          break;
  1035. +         }
  1036. +         break;
  1037. +        }
  1038. +  
  1039. +      if (i==count)
  1040. +    SSVAL(*rparam,0,NERR_JobNotFound);
  1041.  
  1042.        if (queue) free(queue);
  1043.      }
  1044.  
  1045. -  DEBUG(3,("Print job delete job=%d snum=%d\n",jobid,snum));
  1046. +  SSVAL(*rparam,2,0);        /* converter word */
  1047.  
  1048.    return(True);
  1049.  }
  1050. @@ -1053,8 +1080,6 @@
  1051.    char *QueueName = skip_string(str2,1);
  1052.    int snum;
  1053.  
  1054. -  lpq_cache_reset = True;
  1055. -
  1056.    /* check it's a supported varient */
  1057.    if (!(strcsequal(str1,"z") && strcsequal(str2,"")))
  1058.      return(False);
  1059. @@ -1078,12 +1103,13 @@
  1060.  
  1061.    if (snum >= 0) {
  1062.      print_queue_struct *queue=NULL;
  1063. -    int i;
  1064. -    int count = get_printqueue(snum,cnum,&queue,NULL);
  1065. -
  1066. +    int i, count;
  1067. +    lpq_reset(snum);
  1068. +    
  1069. +    count = get_printqueue(snum,cnum,&queue,NULL);
  1070.      for (i = 0; i < count; i++)
  1071.        del_printqueue(cnum,snum,queue[i].job);
  1072. -
  1073. +    
  1074.      if (queue) free(queue);
  1075.    }
  1076.  
  1077. @@ -1094,57 +1120,128 @@
  1078.  
  1079.  
  1080.  /****************************************************************************
  1081. -  set the name of a print job (undocumented?)
  1082. -  ****************************************************************************/
  1083. -static BOOL api_PrintJobInfo(int cnum,int uid, char *param,char *data,
  1084. -                 int mdrcnt,int mprcnt,
  1085. -                 char **rdata,char **rparam,
  1086. -                 int *rdata_len,int *rparam_len)
  1087. +  set the property of a print job (undocumented?)
  1088. +  ? function = 0xb -> set name of print job
  1089. +  ? function = 0x6 -> move print job up/down
  1090. +  Form: <WWsTP> <WWzWWDDzzzzzzzzzzlz> 
  1091. +  or   <WWsTP> <WB21BB16B10zWWzDDz> 
  1092. +****************************************************************************/
  1093. +static int check_printjob_info(struct pack_desc* desc,
  1094. +                   int uLevel, const char* id)
  1095. +{
  1096. +  desc->subformat = NULL;
  1097. +  switch( uLevel ) {
  1098. +  case 0: desc->format = "W"; break;
  1099. +  case 1: desc->format = "WB21BB16B10zWWzDDz"; break;
  1100. +  case 2: desc->format = "WWzWWDDzz"; break;
  1101. +  case 3: desc->format = "WWzWWDDzzzzzzzzzzlz"; break;
  1102. +  default: return False;
  1103. +  }
  1104. +  if (strcmp(desc->format,id) != 0) return False;
  1105. +  return True;
  1106. +}
  1107. +
  1108. +static BOOL api_PrintJobInfo(int cnum,int uid,char *param,char *data,
  1109. +                   int mdrcnt,int mprcnt,
  1110. +                   char **rdata,char **rparam,
  1111. +                   int *rdata_len,int *rparam_len)
  1112.  {
  1113. -  pstring name;
  1114. +  struct pack_desc desc;
  1115. +  char *str1 = param+2;
  1116. +  char *str2 = skip_string(str1,1);
  1117. +  char *p = skip_string(str2,1);
  1118. +  int jobid = (SVAL(p,0)&0xFF); /* the snum and jobid are encoded
  1119. +                    by the print queue api */
  1120. +  int snum = (SVAL(p,0)>>8);
  1121. +  int uLevel = SVAL(p,2);
  1122. +  int function = SVAL(p,4);    /* what is this ?? */
  1123. +  int i;
  1124.    char *s = data;
  1125. +   
  1126.    *rparam_len = 4;
  1127.    *rparam = REALLOC(*rparam,*rparam_len);
  1128. -
  1129. -  lpq_cache_reset = True;
  1130. -
  1131. +  
  1132.    *rdata_len = 0;
  1133. -
  1134. -  SSVAL(*rparam,0,NERR_Success);
  1135. -  SSVAL(*rparam,2,0);        /* converter word */
  1136. -
  1137. -  /* now try to extract the name. As I don't really understand this
  1138. -     API this is mostly guesswork.
  1139. -     */
  1140. -  if (isalpha(*s))
  1141. -    {
  1142. -      int i,l = 0;
  1143. -      while (l<64 && *s)
  1144. -    {
  1145. -      if (isalnum(*s) || strchr("-._",*s))
  1146. -        name[l++] = *s;
  1147. -      s++;
  1148. -    }      
  1149. -      name[l] = 0;
  1150. -
  1151. -      DEBUG(3,("Setting print name to %s\n",name));
  1152. -      
  1153. -      for (i=0;i<MAX_OPEN_FILES;i++)
  1154. -    if (Files[i].open && Files[i].print_file)
  1155. +  
  1156. +  /* check it's a supported varient */
  1157. +  if ((strcmp(str1,"WWsTP")) || (!check_printjob_info(&desc,uLevel,str2)))
  1158. +    return(False);
  1159. +   
  1160. +  switch (function) {
  1161. +  case 0x6:    /* change job place in the queue, data gives the new place */
  1162. +    if (snum >= 0)
  1163. +      {
  1164. +    print_queue_struct *queue=NULL;
  1165. +    int count;
  1166. +  
  1167. +    lpq_reset(snum);
  1168. +    count = get_printqueue(snum,cnum,&queue,NULL);
  1169. +    for (i=0;i<count;i++)    /* find job */
  1170. +      if ((queue[i].job%0xFF) == jobid) break;
  1171. +         
  1172. +    if (i==count) {
  1173. +      desc.errcode=NERR_JobNotFound;
  1174. +      if (queue) free(queue);
  1175. +    }
  1176. +    else {
  1177. +      desc.errcode=NERR_Success;
  1178. +      i++;
  1179. +#if 0    
  1180.        {
  1181. -        pstring wd;
  1182. -        GetWd(wd);
  1183. -        unbecome_user();
  1184. -
  1185. -        if (!become_user(Files[i].cnum,uid) || !become_service(Files[i].cnum,True))
  1186. -          break;
  1187. -
  1188. -        if (rename(Files[i].name,name) == 0)
  1189. -          string_set(&Files[i].name,name);
  1190. -        break;
  1191. +        int place= SVAL(data,0);
  1192. +        /* we currently have no way of doing this. Can any unix do it? */
  1193. +        if (i < place)    /* move down */;
  1194. +        else if (i > place )    /* move up */;
  1195.        }
  1196. -    }
  1197. -
  1198. +#endif
  1199. +      desc.errcode=NERR_notsupported; /* not yet supported */
  1200. +      if (queue) free(queue);
  1201. +    }
  1202. +      }
  1203. +    else desc.errcode=NERR_JobNotFound;
  1204. +    break;
  1205. +  case 0xb:   /* change print job name, data gives the name */
  1206. +    /* jobid, snum should be zero */
  1207. +    if (isalpha(*s))
  1208. +      {
  1209. +    pstring name;
  1210. +    int l = 0;
  1211. +    while (l<64 && *s)
  1212. +      {
  1213. +        if (isalnum(*s) || strchr("-._",*s))
  1214. +          name[l++] = *s;
  1215. +        s++;
  1216. +      }      
  1217. +    name[l] = 0;
  1218. +    
  1219. +    DEBUG(3,("Setting print name to %s\n",name));
  1220. +    
  1221. +    for (i=0;i<MAX_OPEN_FILES;i++)
  1222. +      if (Files[i].open && Files[i].print_file)
  1223. +        {
  1224. +          pstring wd;
  1225. +          GetWd(wd);
  1226. +          unbecome_user();
  1227. +          
  1228. +          if (!become_user(Files[i].cnum,uid) || 
  1229. +          !become_service(Files[i].cnum,True))
  1230. +        break;
  1231. +          
  1232. +          if (rename(Files[i].name,name) == 0)
  1233. +        string_set(&Files[i].name,name);
  1234. +          break;
  1235. +        }
  1236. +      }
  1237. +    desc.errcode=NERR_Success;
  1238. +  
  1239. +    break;
  1240. +  default:            /* not implemented */
  1241. +    return False;
  1242. +  }
  1243. +  SSVALS(*rparam,0,desc.errcode);
  1244. +  SSVAL(*rparam,2,0);        /* converter word */
  1245. +  
  1246.    return(True);
  1247.  }
  1248.  
  1249. @@ -1472,24 +1569,24 @@
  1250.    desc.format = str2;
  1251.  
  1252.    if (init_package(&desc,1,0)) {
  1253. -    PACK(&desc,"W",0);        /* code */
  1254. -    PACK(&desc,"B21",name);    /* eff. name */
  1255. -    PACK(&desc,"B","");        /* pad */
  1256. -    PACK(&desc,"W",2);        /* priv */
  1257. -    PACK(&desc,"D",0);        /* auth flags */
  1258. -    PACK(&desc,"W",0);        /* num logons */
  1259. -    PACK(&desc,"W",0);        /* bad pw count */
  1260. -    PACK(&desc,"D",0);        /* last logon */
  1261. -    PACK(&desc,"D",0);        /* last logoff */
  1262. -    PACK(&desc,"D",-1);        /* logoff time */
  1263. -    PACK(&desc,"D",-1);        /* kickoff time */
  1264. -    PACK(&desc,"D",0);        /* password age */
  1265. -    PACK(&desc,"D",0);        /* password can change */
  1266. -    PACK(&desc,"D",-1);        /* password must change */
  1267. -    PACK(&desc,"z",local_machine);/* computer */
  1268. -    PACK(&desc,"z",lp_workgroup());/* domain */
  1269. -    PACK(&desc,"z",0);        /* script path */
  1270. -    PACK(&desc,"D",0);        /* reserved */
  1271. +    PACKI(&desc,"W",0);        /* code */
  1272. +    PACKS(&desc,"B21",name);    /* eff. name */
  1273. +    PACKS(&desc,"B","");        /* pad */
  1274. +    PACKI(&desc,"W",2);        /* priv */
  1275. +    PACKI(&desc,"D",0);        /* auth flags */
  1276. +    PACKI(&desc,"W",0);        /* num logons */
  1277. +    PACKI(&desc,"W",0);        /* bad pw count */
  1278. +    PACKI(&desc,"D",0);        /* last logon */
  1279. +    PACKI(&desc,"D",0);        /* last logoff */
  1280. +    PACKI(&desc,"D",-1);        /* logoff time */
  1281. +    PACKI(&desc,"D",-1);        /* kickoff time */
  1282. +    PACKI(&desc,"D",0);        /* password age */
  1283. +    PACKI(&desc,"D",0);        /* password can change */
  1284. +    PACKI(&desc,"D",-1);        /* password must change */
  1285. +    PACKS(&desc,"z",local_machine);/* computer */
  1286. +    PACKS(&desc,"z",lp_workgroup());/* domain */
  1287. +    PACKS(&desc,"z","");        /* script path */
  1288. +    PACKI(&desc,"D",0);        /* reserved */
  1289.    }
  1290.  
  1291.    *rdata_len = desc.usedlen;
  1292. @@ -1535,22 +1632,6 @@
  1293.  /****************************************************************************
  1294.    api_WPrintJobEnumerate
  1295.    ****************************************************************************/
  1296. -
  1297. -static int check_printjob_info(struct pack_desc* desc,
  1298. -                   int uLevel, const char* id)
  1299. -{
  1300. -  desc->subformat = NULL;
  1301. -  switch( uLevel ) {
  1302. -  case 0: desc->format = "W"; break;
  1303. -  case 1: desc->format = "WB21BB16B10zWWzDDz"; break;
  1304. -  case 2: desc->format = "WWzWWDDzz"; break;
  1305. -  case 3: desc->format = "WWzWWDDzzzzzzzzzzlz"; break;
  1306. -  default: return False;
  1307. -  }
  1308. -  if (strcmp(desc->format,id) != 0) return False;
  1309. -  return True;
  1310. -}
  1311. -
  1312.  static BOOL api_WPrintJobGetInfo(int cnum,int uid, char *param,char *data,
  1313.                   int mdrcnt,int mprcnt,
  1314.                   char **rdata,char **rparam,
  1315. @@ -1705,27 +1786,27 @@
  1316.    strcpy(buf,SERVICE(snum));
  1317.    strupper(buf);
  1318.    if (uLevel <= 1) {
  1319. -    PACK(desc,"B9",buf);    /* szName */
  1320. +    PACKS(desc,"B9",buf);    /* szName */
  1321.      if (uLevel == 1) {
  1322. -      PACK(desc,"B21","");    /* szUserName */
  1323. -      PACK(desc,"W",0);        /* uJobId */
  1324. -      PACK(desc,"W",0);        /* fsStatus */
  1325. -      PACK(desc,"z","");    /* pszStatus */
  1326. -      PACK(desc,"W",0);        /* time */
  1327. +      PACKS(desc,"B21","");    /* szUserName */
  1328. +      PACKI(desc,"W",0);        /* uJobId */
  1329. +      PACKI(desc,"W",0);        /* fsStatus */
  1330. +      PACKS(desc,"z","");    /* pszStatus */
  1331. +      PACKI(desc,"W",0);        /* time */
  1332.      }
  1333.    }
  1334.    if (uLevel == 2 || uLevel == 3) {
  1335. -    PACK(desc,"z",buf);        /* pszPrinterName */
  1336. +    PACKS(desc,"z",buf);        /* pszPrinterName */
  1337.      if (uLevel == 3) {
  1338. -      PACK(desc,"z","");    /* pszUserName */
  1339. -      PACK(desc,"z",0);        /* pszLogAddr */
  1340. -      PACK(desc,"W",0);        /* uJobId */
  1341. -      PACK(desc,"W",0);        /* fsStatus */
  1342. -      PACK(desc,"z","");    /* pszStatus */
  1343. -      PACK(desc,"z","");    /* pszComment */
  1344. -      PACK(desc,"z","NULL"); /* pszDrivers */
  1345. -      PACK(desc,"W",0);        /* time */
  1346. -      PACK(desc,"W",0);        /* pad1 */
  1347. +      PACKS(desc,"z","");    /* pszUserName */
  1348. +      PACKS(desc,"z","");    /* pszLogAddr */
  1349. +      PACKI(desc,"W",0);        /* uJobId */
  1350. +      PACKI(desc,"W",0);        /* fsStatus */
  1351. +      PACKS(desc,"z","");    /* pszStatus */
  1352. +      PACKS(desc,"z","");    /* pszComment */
  1353. +      PACKS(desc,"z","NULL"); /* pszDrivers */
  1354. +      PACKI(desc,"W",0);        /* time */
  1355. +      PACKI(desc,"W",0);        /* pad1 */
  1356.      }
  1357.    }
  1358.  }
  1359. @@ -1874,7 +1955,7 @@
  1360.    desc.base = *rdata;
  1361.    desc.buflen = mdrcnt;
  1362.    if (init_package(&desc,1,0)) {
  1363. -    PACK(&desc,"B41","NULL");
  1364. +    PACKS(&desc,"B41","NULL");
  1365.    }
  1366.  
  1367.    succnt = (desc.errcode == NERR_Success ? 1 : 0);
  1368. @@ -1920,7 +2001,7 @@
  1369.    desc.buflen = mdrcnt;
  1370.    desc.format = str2;
  1371.    if (init_package(&desc,1,0)) {
  1372. -    PACK(&desc,"B13","lpd");
  1373. +    PACKS(&desc,"B13","lpd");
  1374.    }
  1375.  
  1376.    succnt = (desc.errcode == NERR_Success ? 1 : 0);
  1377. @@ -1967,7 +2048,7 @@
  1378.    desc.buflen = mdrcnt;
  1379.    desc.format = str2;
  1380.    if (init_package(&desc,1,0)) {
  1381. -    PACK(&desc,"B13","lp0");
  1382. +    PACKS(&desc,"B13","lp0");
  1383.    }
  1384.  
  1385.    succnt = (desc.errcode == NERR_Success ? 1 : 0);
  1386. @@ -2047,6 +2128,8 @@
  1387.    {"WPrintJobEnumerate",76,    api_WPrintJobEnumerate,0},
  1388.    {"WPrintJobGetInfo",    77,    api_WPrintJobGetInfo,0},
  1389.    {"RDosPrintJobDel",    81,    api_RDosPrintJobDel,0},
  1390. +  {"RDosPrintJobPause",    82,    api_RDosPrintJobDel,0},
  1391. +  {"RDosPrintJobResume",83,    api_RDosPrintJobDel,0},
  1392.    {"WPrintDestEnum",    84,    api_WPrintDestEnum,0},
  1393.    {"WPrintDestGetInfo",    85,    api_WPrintDestGetInfo,0},
  1394.    {"NetRemoteTOD",    91,    api_NetRemoteTOD,0},
  1395. diff -u -r --new-file last-version/source/kanji.c samba-1.9.14alpha17/source/kanji.c
  1396. --- last-version/source/kanji.c    Thu Jun 29 18:18:23 1995
  1397. +++ samba-1.9.14alpha17/source/kanji.c    Fri Sep 15 20:17:44 1995
  1398. @@ -20,22 +20,69 @@
  1399.  
  1400.     Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5
  1401.       and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
  1402. -   Adding for Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
  1403. +     and add all jis codes sequence type at 1995.8.16
  1404. +     Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
  1405.  */
  1406.  #ifdef KANJI
  1407.  
  1408.  #define _KANJI_C_
  1409.  #include "includes.h"
  1410.  
  1411. -#include "kanji.h"
  1412. -
  1413.  /* coding system keep in */
  1414.  int coding_system = SJIS_CODE;
  1415.  
  1416. -/*
  1417. +/* jis si/so sequence */
  1418. +char jis_kso = JIS_KSO;
  1419. +char jis_ksi = JIS_KSI;
  1420. +char hex_tag = HEXTAG;
  1421. +
  1422. +/*******************************************************************
  1423. +  SHIFT JIS functions
  1424. +********************************************************************/
  1425. +/*******************************************************************
  1426. + search token from S1 separated any char of S2
  1427. + S1 contain SHIFT JIS chars.
  1428. +********************************************************************/
  1429. +char *
  1430. +sj_strtok (char *s1, const char *s2)
  1431. +{
  1432. +    static char *s = NULL;
  1433. +    char *q;
  1434. +    if (!s1) {
  1435. +    if (!s) {
  1436. +        return NULL;
  1437. +    }
  1438. +    s1 = s;
  1439. +    }
  1440. +    for (q = s1; *s1; ) {
  1441. +    if (is_shift_jis (*s1)) {
  1442. +        s1 += 2;
  1443. +    } else if (is_kana (*s1)) {
  1444. +        s1++;
  1445. +    } else {
  1446. +        char *p = strchr (s2, *s1);
  1447. +        if (p) {
  1448. +        if (s1 != q) {
  1449. +            s = s1 + 1;
  1450. +            *s1 = '\0';
  1451. +            return q;
  1452. +        }
  1453. +        q = s1 + 1;
  1454. +        }
  1455. +        s1++;
  1456. +    }
  1457. +    }
  1458. +    s = NULL;
  1459. +    if (*q) {
  1460. +    return q;
  1461. +    }
  1462. +    return NULL;
  1463. +}
  1464. +
  1465. +/*******************************************************************
  1466.   search string S2 from S1
  1467.   S1 contain SHIFT JIS chars.
  1468. -*/
  1469. +********************************************************************/
  1470.  char *
  1471.  sj_strstr (const char *s1, const char *s2)
  1472.  {
  1473. @@ -56,10 +103,10 @@
  1474.      return 0;
  1475.  }
  1476.  
  1477. -/*
  1478. +/*******************************************************************
  1479.   Search char C from beginning of S.
  1480.   S contain SHIFT JIS chars.
  1481. -*/
  1482. +********************************************************************/
  1483.  char *
  1484.  sj_strchr (const char *s, int c)
  1485.  {
  1486. @@ -75,10 +122,10 @@
  1487.      return 0;
  1488.  }
  1489.  
  1490. -/*
  1491. +/*******************************************************************
  1492.   Search char C end of S.
  1493.   S contain SHIFT JIS chars.
  1494. -*/
  1495. +********************************************************************/
  1496.  char *
  1497.  sj_strrchr (const char *s, int c)
  1498.  {
  1499. @@ -97,9 +144,15 @@
  1500.      return q;
  1501.  }
  1502.  
  1503. +/*******************************************************************
  1504. +  Code conversion
  1505. +********************************************************************/
  1506.  /* convesion buffer */
  1507.  static char cvtbuf[1024];
  1508.  
  1509. +/*******************************************************************
  1510. +  EUC <-> SJIS
  1511. +********************************************************************/
  1512.  static int
  1513.  euc2sjis (register int hi, register int lo)
  1514.  {
  1515. @@ -120,10 +173,10 @@
  1516.          (lo + (lo >= 0x7f ? 0x60 : 0x61));
  1517.  }
  1518.  
  1519. -/*
  1520. +/*******************************************************************
  1521.   Convert FROM contain SHIFT JIS codes to EUC codes
  1522.   return converted buffer
  1523. - */
  1524. +********************************************************************/
  1525.  static char *
  1526.  sj_to_euc (const char *from, BOOL overwrite)
  1527.  {
  1528. @@ -153,10 +206,10 @@
  1529.      }
  1530.  }
  1531.  
  1532. -/*
  1533. +/*******************************************************************
  1534.   Convert FROM contain EUC codes to SHIFT JIS codes
  1535.   return converted buffer
  1536. -*/
  1537. +********************************************************************/
  1538.  static char *
  1539.  euc_to_sj (const char *from, BOOL overwrite)
  1540.  {
  1541. @@ -186,6 +239,9 @@
  1542.      }
  1543.  }
  1544.  
  1545. +/*******************************************************************
  1546. +  JIS7,JIS8,JUNET <-> SJIS
  1547. +********************************************************************/
  1548.  static int
  1549.  sjis2jis (register int hi, register int lo)
  1550.  {
  1551. @@ -206,10 +262,10 @@
  1552.      return ((hi / 2 + (hi < 0x5f ? 0x70 : 0xb0)) << 8) | (lo + 0x7e);
  1553.  }
  1554.  
  1555. -/*
  1556. +/*******************************************************************
  1557.   Convert FROM contain JIS codes to SHIFT JIS codes
  1558.   return converted buffer
  1559. - */
  1560. +********************************************************************/
  1561.  static char *
  1562.  jis8_to_sj (const char *from, BOOL overwrite)
  1563.  {
  1564. @@ -257,10 +313,10 @@
  1565.      }
  1566.  }
  1567.  
  1568. -/*
  1569. +/*******************************************************************
  1570.   Convert FROM contain SHIFT JIS codes to JIS codes
  1571.   return converted buffer
  1572. -*/
  1573. +********************************************************************/
  1574.  static char *
  1575.  sj_to_jis8 (const char *from, BOOL overwrite)
  1576.  {
  1577. @@ -277,7 +333,7 @@
  1578.          case _KJ_ROMAN:        /* to KANJI */
  1579.          *out++ = jis_esc;
  1580.          *out++ = jis_so1;
  1581. -        *out++ = JIS_KSO;
  1582. +        *out++ = jis_kso;
  1583.          shifted = _KJ_KANJI;
  1584.          break;
  1585.          }
  1586. @@ -290,7 +346,7 @@
  1587.          case _KJ_KANJI:        /* to ROMAN/KANA */
  1588.          *out++ = jis_esc;
  1589.          *out++ = jis_si1;
  1590. -        *out++ = JIS_KSI;
  1591. +        *out++ = jis_ksi;
  1592.          shifted = _KJ_ROMAN;
  1593.          break;
  1594.          }
  1595. @@ -301,7 +357,7 @@
  1596.      case _KJ_KANJI:            /* to ROMAN/KANA */
  1597.      *out++ = jis_esc;
  1598.      *out++ = jis_si1;
  1599. -    *out++ = JIS_KSI;
  1600. +    *out++ = jis_ksi;
  1601.      shifted = _KJ_ROMAN;
  1602.      break;
  1603.      }
  1604. @@ -314,10 +370,10 @@
  1605.      }
  1606.  }
  1607.  
  1608. -/*
  1609. +/*******************************************************************
  1610.   Convert FROM contain 7 bits JIS codes to SHIFT JIS codes
  1611.   return converted buffer
  1612. - */
  1613. +********************************************************************/
  1614.  static char *
  1615.  jis7_to_sj (const char *from, BOOL overwrite)
  1616.  {
  1617. @@ -374,10 +430,10 @@
  1618.      }
  1619.  }
  1620.  
  1621. -/*
  1622. +/*******************************************************************
  1623.   Convert FROM contain SHIFT JIS codes to 7 bits JIS codes
  1624.   return converted buffer
  1625. -*/
  1626. +********************************************************************/
  1627.  static char *
  1628.  sj_to_jis7 (const char *from, BOOL overwrite)
  1629.  {
  1630. @@ -396,7 +452,7 @@
  1631.          case _KJ_ROMAN:        /* to KANJI */
  1632.          *out++ = jis_esc;
  1633.          *out++ = jis_so1;
  1634. -        *out++ = JIS_KSO;
  1635. +        *out++ = jis_kso;
  1636.          shifted = _KJ_KANJI;
  1637.          break;
  1638.          }
  1639. @@ -409,7 +465,7 @@
  1640.          case _KJ_KANJI:        /* to ROMAN */
  1641.          *out++ = jis_esc;
  1642.          *out++ = jis_si1;
  1643. -        *out++ = JIS_KSI;
  1644. +        *out++ = jis_ksi;
  1645.          case _KJ_ROMAN:        /* to KANA */
  1646.          *out++ = jis_so;
  1647.          shifted = _KJ_KANA;
  1648. @@ -425,7 +481,7 @@
  1649.          case _KJ_KANJI:        /* to ROMAN */
  1650.          *out++ = jis_esc;
  1651.          *out++ = jis_si1;
  1652. -        *out++ = JIS_KSI;
  1653. +        *out++ = jis_ksi;
  1654.          shifted = _KJ_ROMAN;
  1655.          break;
  1656.          }
  1657. @@ -439,7 +495,7 @@
  1658.      case _KJ_KANJI:            /* to ROMAN */
  1659.      *out++ = jis_esc;
  1660.      *out++ = jis_si1;
  1661. -    *out++ = JIS_KSI;
  1662. +    *out++ = jis_ksi;
  1663.      break;
  1664.      }
  1665.      *out = 0;
  1666. @@ -451,10 +507,10 @@
  1667.      }
  1668.  }
  1669.  
  1670. -/*
  1671. +/*******************************************************************
  1672.   Convert FROM contain 7 bits JIS(junet) codes to SHIFT JIS codes
  1673.   return converted buffer
  1674. - */
  1675. +********************************************************************/
  1676.  static char *
  1677.  junet_to_sj (const char *from, BOOL overwrite)
  1678.  {
  1679. @@ -474,7 +530,7 @@
  1680.          from += 3;
  1681.          } else if (is_juk1(from[1]) && is_juk2 (from[2])) {
  1682.          shifted = _KJ_KANA;
  1683. -        break;
  1684. +        from += 3;
  1685.          } else {            /* sequence error */
  1686.          goto normal;
  1687.          }
  1688. @@ -508,10 +564,10 @@
  1689.      }
  1690.  }
  1691.  
  1692. -/*
  1693. +/*******************************************************************
  1694.   Convert FROM contain SHIFT JIS codes to 7 bits JIS(junet) codes
  1695.   return converted buffer
  1696. -*/
  1697. +********************************************************************/
  1698.  static char *
  1699.  sj_to_junet (const char *from, BOOL overwrite)
  1700.  {
  1701. @@ -578,43 +634,38 @@
  1702.      }
  1703.  }
  1704.  
  1705. -#define HEXTAG ':'
  1706. -
  1707. -#define hex2bin(x)                              \
  1708. -    ( ((int) '0' <= ((int) (x)) && ((int) (x)) <= (int)'9')?          \
  1709. -        (((int) (x))-(int)'0'):                          \
  1710. -      ((int) 'a'<= ((int) (x)) && ((int) (x))<= (int) 'f')?          \
  1711. -        (((int) (x)) - (int)'a'+10):                      \
  1712. -      (((int) (x)) - (int)'A'+10) )
  1713. -#define bin2hex(x)                              \
  1714. -    ( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') )
  1715. +/*******************************************************************
  1716. +  HEX <-> SJIS
  1717. +********************************************************************/
  1718.  /* ":xx" -> a byte */
  1719.  static char *
  1720. -hex_to_sj(char *from, BOOL overwrite)
  1721. +hex_to_sj (const char *from, BOOL overwrite)
  1722.  {
  1723.      char *sp, *dp;
  1724.      
  1725. -    sp = from; dp = cvtbuf;
  1726. +    sp = (char *) from;
  1727. +    dp = cvtbuf;
  1728.      while (*sp) {
  1729. -    if (*sp == HEXTAG && isxdigit(sp[1]) && isxdigit(sp[2])) {
  1730. -        *dp++ = (hex2bin(sp[1])<<4) | (hex2bin(sp[2]));
  1731. +    if (*sp == hex_tag && isxdigit (sp[1]) && isxdigit (sp[2])) {
  1732. +        *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2]));
  1733.          sp += 3;
  1734.      } else
  1735.          *dp++ = *sp++;
  1736.      }
  1737.      *dp = '\0';
  1738.      if (overwrite) {
  1739. -    strcpy((char *) from, (const char *) cvtbuf);
  1740. +    strcpy ((char *) from, (const char *) cvtbuf);
  1741.      return (char *) from;
  1742.      } else {
  1743.      return cvtbuf;
  1744.      }
  1745.  }
  1746.   
  1747. -/* kanji/kana -> ":xx" */
  1748. +/*******************************************************************
  1749. +  kanji/kana -> ":xx" 
  1750. +********************************************************************/
  1751.  static char *
  1752. -sj_to_hex(char *from, BOOL overwrite)
  1753. +sj_to_hex (const char *from, BOOL overwrite)
  1754.  {
  1755.      unsigned char *sp, *dp;
  1756.      
  1757. @@ -622,99 +673,90 @@
  1758.      dp = (unsigned char*) cvtbuf;
  1759.      while (*sp) {
  1760.      if (is_kana(*sp)) {
  1761. -        *dp++ = HEXTAG;
  1762. -        *dp++ = bin2hex(((*sp)>>4)&0x0f);
  1763. -        *dp++ = bin2hex((*sp)&0x0f);
  1764. +        *dp++ = hex_tag;
  1765. +        *dp++ = bin2hex (((*sp)>>4)&0x0f);
  1766. +        *dp++ = bin2hex ((*sp)&0x0f);
  1767.          sp++;
  1768. -    } else if (is_shift_jis(*sp) && is_shift_jis2(sp[1])) {
  1769. -        *dp++ = HEXTAG;
  1770. -        *dp++ = bin2hex(((*sp)>>4)&0x0f);
  1771. -        *dp++ = bin2hex((*sp)&0x0f);
  1772. +    } else if (is_shift_jis (*sp) && is_shift_jis2 (sp[1])) {
  1773. +        *dp++ = hex_tag;
  1774. +        *dp++ = bin2hex (((*sp)>>4)&0x0f);
  1775. +        *dp++ = bin2hex ((*sp)&0x0f);
  1776.          sp++;
  1777. -        *dp++ = HEXTAG;
  1778. -        *dp++ = bin2hex(((*sp)>>4)&0x0f);
  1779. -        *dp++ = bin2hex((*sp)&0x0f);
  1780. +        *dp++ = hex_tag;
  1781. +        *dp++ = bin2hex (((*sp)>>4)&0x0f);
  1782. +        *dp++ = bin2hex ((*sp)&0x0f);
  1783.          sp++;
  1784.      } else
  1785.          *dp++ = *sp++;
  1786.      }
  1787.      *dp = '\0';
  1788.      if (overwrite) {
  1789. -    strcpy((char *) from, (const char *) cvtbuf);
  1790. +    strcpy ((char *) from, (const char *) cvtbuf);
  1791.      return (char *) from;
  1792.      } else {
  1793.      return cvtbuf;
  1794.      }
  1795.  }
  1796.  
  1797. -/*
  1798. - * Convert coding_system CODE to dos CODE(sjis)
  1799. - */
  1800. -char *
  1801. -kj_dos_format (char *str, BOOL overwrite)
  1802. +/*******************************************************************
  1803. + sj to sj
  1804. +********************************************************************/
  1805. +static char *
  1806. +sj_to_sj (const char *from, BOOL overwrite)
  1807.  {
  1808. -    static char* (*func)() = 0;
  1809. -    static int func_inited = 0;
  1810. -
  1811. -    if (!func_inited) {
  1812. -    switch (coding_system) {
  1813. -    case EUC_CODE:
  1814. -        func = euc_to_sj;
  1815. -        break;
  1816. -    case JIS7_CODE:
  1817. -        func = jis7_to_sj;
  1818. -        break;
  1819. -    case JIS8_CODE:
  1820. -        func = jis8_to_sj;
  1821. -        break;
  1822. -    case JUNET_CODE:
  1823. -        func = junet_to_sj;
  1824. -        break;
  1825. -    case HEX_CODE:
  1826. -        func = hex_to_sj;
  1827. -        break;
  1828. -    default:
  1829. -    case SJIS_CODE:
  1830. -        break;            /* nothing to convert */
  1831. -    }
  1832. -    func_inited = 1;
  1833. +    if (!overwrite) {
  1834. +    strcpy (cvtbuf, (const char *) from);
  1835. +    return cvtbuf;
  1836. +    } else {
  1837. +    return (char *) from;
  1838.      }
  1839. -    return (func ? (*func) (str, overwrite) : str);
  1840.  }
  1841.  
  1842. -/*
  1843. - * Convert dos CODE(sjis) to coding_system CODE
  1844. - */
  1845. -char *
  1846. -kj_unix_format (char *str, BOOL overwrite)
  1847. +/************************************************************************
  1848. + conversion:
  1849. + _dos_to_unix        _unix_to_dos
  1850. +************************************************************************/
  1851. +
  1852. +char* (*_dos_to_unix) (const char *str, BOOL overwrite) = sj_to_sj;
  1853. +char* (*_unix_to_dos) (const char *str, BOOL overwrite) = sj_to_sj;
  1854. +
  1855. +static int
  1856. +setup_string_function (int codes)
  1857.  {
  1858. -    static char* (*func)() = 0;
  1859. -    static int func_inited = 0;
  1860. +    switch (codes) {
  1861. +    default:
  1862. +    case SJIS_CODE:
  1863. +    _dos_to_unix = sj_to_sj;
  1864. +    _unix_to_dos = sj_to_sj;
  1865.  
  1866. -    if (!func_inited) {
  1867. -    switch (coding_system) {
  1868. -    case EUC_CODE:
  1869. -        func = sj_to_euc;
  1870. -        break;
  1871. -    case JIS7_CODE:
  1872. -        func = sj_to_jis7;
  1873. -        break;
  1874. -    case JIS8_CODE:
  1875. -        func = sj_to_jis8;
  1876. -        break;
  1877. -    case JUNET_CODE:
  1878. -        func = sj_to_junet;
  1879. -        break;
  1880. -    case HEX_CODE:
  1881. -        func = sj_to_hex;
  1882. -        break;
  1883. -    default:
  1884. -    case SJIS_CODE:
  1885. -        break;            /* nothing to convert */
  1886. -    }
  1887. -    func_inited = 1;
  1888. +    break;
  1889. +    
  1890. +    case EUC_CODE:
  1891. +    _dos_to_unix = sj_to_euc;
  1892. +    _unix_to_dos = euc_to_sj;
  1893. +    break;
  1894. +    
  1895. +    case JIS7_CODE:
  1896. +    _dos_to_unix = sj_to_jis7;
  1897. +    _unix_to_dos = jis7_to_sj;
  1898. +    break;
  1899. +
  1900. +    case JIS8_CODE:
  1901. +    _dos_to_unix = sj_to_jis8;
  1902. +    _unix_to_dos = jis8_to_sj;
  1903. +    break;
  1904. +
  1905. +    case JUNET_CODE:
  1906. +    _dos_to_unix = sj_to_junet;
  1907. +    _unix_to_dos = junet_to_sj;
  1908. +    break;
  1909. +
  1910. +    case HEX_CODE:
  1911. +    _dos_to_unix = sj_to_hex;
  1912. +    _unix_to_dos = hex_to_sj;
  1913. +    break;
  1914.      }
  1915. -    return (func ? (*func) (str, overwrite) : str);
  1916. +    return codes;
  1917.  }
  1918.  
  1919.  /*
  1920. @@ -723,20 +765,92 @@
  1921.  int 
  1922.  interpret_coding_system (char *str, int def)
  1923.  {
  1924. +    int codes = def;
  1925. +    
  1926.      if (strequal (str, "sjis")) {
  1927. -    return SJIS_CODE;
  1928. +    codes = SJIS_CODE;
  1929.      } else if (strequal (str, "euc")) {
  1930. -    return EUC_CODE;
  1931. -    } else if (strequal (str, "jis8")) {
  1932. -    return JIS8_CODE;
  1933. -    } else if (strequal (str, "jis7")) {
  1934. -    return JIS7_CODE;
  1935. -    } else if (strequal (str, "junet")) {
  1936. -    return JUNET_CODE;
  1937. +    codes = EUC_CODE;
  1938.      } else if (strequal (str, "hex")) {
  1939. -    return HEX_CODE;
  1940. -    }
  1941. -    return def;
  1942. +    codes = HEX_CODE;
  1943. +    hex_tag = HEXTAG;
  1944. +    } else if (strncasecmp (str, "hex", 3)) {
  1945. +    codes = HEX_CODE;
  1946. +    hex_tag = (str[3] ? str[3] : HEXTAG);
  1947. +    } else if (strequal (str, "j8bb")) {
  1948. +    codes = JIS8_CODE;
  1949. +    jis_kso = 'B';
  1950. +    jis_ksi = 'B';
  1951. +    } else if (strequal (str, "j8bj") || strequal (str, "jis8")) {
  1952. +    codes = JIS8_CODE;
  1953. +    jis_kso = 'B';
  1954. +    jis_ksi = 'J';
  1955. +    } else if (strequal (str, "j8bh")) {
  1956. +    codes = JIS8_CODE;
  1957. +    jis_kso = 'B';
  1958. +    jis_ksi = 'H';
  1959. +    } else if (strequal (str, "j8@b")) {
  1960. +    codes = JIS8_CODE;
  1961. +    jis_kso = '@';
  1962. +    jis_ksi = 'B';
  1963. +    } else if (strequal (str, "j8@j")) {
  1964. +    codes = JIS8_CODE;
  1965. +    jis_kso = '@';
  1966. +    jis_ksi = 'J';
  1967. +    } else if (strequal (str, "j8@h")) {
  1968. +    codes = JIS8_CODE;
  1969. +    jis_kso = '@';
  1970. +    jis_ksi = 'H';
  1971. +    } else if (strequal (str, "j7bb")) {
  1972. +    codes = JIS7_CODE;
  1973. +    jis_kso = 'B';
  1974. +    jis_ksi = 'B';
  1975. +    } else if (strequal (str, "j7bj") || strequal (str, "jis7")) {
  1976. +    codes = JIS7_CODE;
  1977. +    jis_kso = 'B';
  1978. +    jis_ksi = 'J';
  1979. +    } else if (strequal (str, "j7bh")) {
  1980. +    codes = JIS7_CODE;
  1981. +    jis_kso = 'B';
  1982. +    jis_ksi = 'H';
  1983. +    } else if (strequal (str, "j7@b")) {
  1984. +    codes = JIS7_CODE;
  1985. +    jis_kso = '@';
  1986. +    jis_ksi = 'B';
  1987. +    } else if (strequal (str, "j7@j")) {
  1988. +    codes = JIS7_CODE;
  1989. +    jis_kso = '@';
  1990. +    jis_ksi = 'J';
  1991. +    } else if (strequal (str, "j7@h")) {
  1992. +    codes = JIS7_CODE;
  1993. +    jis_kso = '@';
  1994. +    jis_ksi = 'H';
  1995. +    } else if (strequal (str, "jubb")) {
  1996. +    codes = JUNET_CODE;
  1997. +    jis_kso = 'B';
  1998. +    jis_ksi = 'B';
  1999. +    } else if (strequal (str, "jubj") || strequal (str, "junet")) {
  2000. +    codes = JUNET_CODE;
  2001. +    jis_kso = 'B';
  2002. +    jis_ksi = 'J';
  2003. +    } else if (strequal (str, "jubh")) {
  2004. +    codes = JUNET_CODE;
  2005. +    jis_kso = 'B';
  2006. +    jis_ksi = 'H';
  2007. +    } else if (strequal (str, "ju@b")) {
  2008. +    codes = JUNET_CODE;
  2009. +    jis_kso = '@';
  2010. +    jis_ksi = 'B';
  2011. +    } else if (strequal (str, "ju@j")) {
  2012. +    codes = JUNET_CODE;
  2013. +    jis_kso = '@';
  2014. +    jis_ksi = 'J';
  2015. +    } else if (strequal (str, "ju@h")) {
  2016. +    codes = JUNET_CODE;
  2017. +    jis_kso = '@';
  2018. +    jis_ksi = 'H';
  2019. +    }    
  2020. +    return setup_string_function (codes);
  2021.  }
  2022.  #else 
  2023.  int kanji_dummy_procedure(void)
  2024. diff -u -r --new-file last-version/source/kanji.h samba-1.9.14alpha17/source/kanji.h
  2025. --- last-version/source/kanji.h    Thu Jun 29 18:18:28 1995
  2026. +++ samba-1.9.14alpha17/source/kanji.h    Fri Sep 15 20:17:44 1995
  2027. @@ -20,11 +20,17 @@
  2028.  
  2029.     Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5
  2030.       and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
  2031. -   Adding for Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
  2032. +     and add all jis codes sequence at 1995.8.16
  2033. +     Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
  2034.  */
  2035.  #ifndef _KANJI_H_
  2036.  #define _KANJI_H_
  2037.  
  2038. +#ifdef KANJI
  2039. +#ifndef REPLACE_RENAME
  2040. +#define REPLACE_RENAME
  2041. +#endif
  2042. +
  2043.  /* FOR SHIFT JIS CODE */
  2044.  #define is_shift_jis(c) \
  2045.      ((0x80 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0x9f) \
  2046. @@ -74,10 +80,35 @@
  2047.  #define _KJ_KANJI (1)
  2048.  #define _KJ_KANA (2)
  2049.  
  2050. +/* FOR HEX */
  2051. +#define HEXTAG ':'
  2052. +#define hex2bin(x)                              \
  2053. +    ( ((int) '0' <= ((int) (x)) && ((int) (x)) <= (int)'9')?          \
  2054. +        (((int) (x))-(int)'0'):                          \
  2055. +      ((int) 'a'<= ((int) (x)) && ((int) (x))<= (int) 'f')?          \
  2056. +        (((int) (x)) - (int)'a'+10):                      \
  2057. +      (((int) (x)) - (int)'A'+10) )
  2058. +#define bin2hex(x)                              \
  2059. +    ( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') )
  2060. +
  2061.  #else /* not _KANJI_C_ */
  2062. +
  2063. +extern char* (*_dos_to_unix) (const char *str, BOOL overwrite);
  2064. +extern char* (*_unix_to_dos) (const char *str, BOOL overwrite);
  2065. +
  2066. +#define unix_to_dos (*_unix_to_dos)
  2067. +#define dos_to_unix (*_dos_to_unix)
  2068. +
  2069. +extern char *sj_strtok (char *s1, const char *s2);
  2070. +extern char *sj_strchr (const char *s, int c);
  2071. +extern char *sj_strrchr (const char *s, int c);
  2072. +extern char *sj_strstr (const char *s1, const char *s2);
  2073. +
  2074.  #define strchr sj_strchr
  2075.  #define strrchr sj_strrchr
  2076.  #define strstr sj_strstr
  2077. +#define strtok sj_strtok
  2078. +
  2079.  #endif /* _KANJI_C_ */
  2080.  
  2081.  #define UNKNOWN_CODE (-1)
  2082. @@ -89,12 +120,13 @@
  2083.  #define HEX_CODE (5)
  2084.  #define DOSV_CODE SJIS_CODE
  2085.  
  2086. -char *sj_strstr (const char *s1, const char *s2);
  2087. -char *sj_strchr (const char *s, int c);
  2088. -char *sj_strrchr (const char *s, int c);
  2089. -
  2090.  int interpret_coding_system (char *str, int def);
  2091. -char *kj_dos_format (char *str, BOOL overwrite);
  2092. -char *kj_unix_format (char *str, BOOL overwrite);
  2093. +
  2094. +#else 
  2095. +
  2096. +#define unix_to_dos(x,y) (x)
  2097. +#define dos_to_unix(x,y) (x)
  2098. +
  2099. +#endif /* not KANJI */
  2100.  
  2101.  #endif /* _KANJI_H_ */
  2102. diff -u -r --new-file last-version/source/loadparm.c samba-1.9.14alpha17/source/loadparm.c
  2103. --- last-version/source/loadparm.c    Sat Sep  2 13:35:39 1995
  2104. +++ samba-1.9.14alpha17/source/loadparm.c    Fri Sep 15 17:58:05 1995
  2105. @@ -179,6 +179,8 @@
  2106.    char *szPrintcommand;
  2107.    char *szLpqcommand;
  2108.    char *szLprmcommand;
  2109. +  char *szLppausecommand;
  2110. +  char *szLpresumecommand;
  2111.    char *szPrintername;
  2112.    char *szDontdescend;
  2113.    char *szHostsallow;
  2114. @@ -246,6 +248,8 @@
  2115.    NULL,    /* szPrintcommand */
  2116.    NULL,    /* szLpqcommand */
  2117.    NULL,    /* szLprmcommand */
  2118. +  NULL,    /* szLppausecommand */
  2119. +  NULL,    /* szLpresumecommand */
  2120.    NULL,    /* szPrintername */
  2121.    NULL,    /* szDontdescend */
  2122.    NULL,    /* szHostsallow */
  2123. @@ -449,6 +453,8 @@
  2124.    {"print command",    P_STRING,  P_LOCAL,  &sDefault.szPrintcommand,   NULL},
  2125.    {"lpq command",      P_STRING,  P_LOCAL,  &sDefault.szLpqcommand,     NULL},
  2126.    {"lprm command",     P_STRING,  P_LOCAL,  &sDefault.szLprmcommand,    NULL},
  2127. +  {"lppause command",  P_STRING,  P_LOCAL,  &sDefault.szLppausecommand, NULL},
  2128. +  {"lpresume command", P_STRING,  P_LOCAL,  &sDefault.szLpresumecommand,NULL},
  2129.    {"printer",          P_STRING,  P_LOCAL,  &sDefault.szPrintername,    NULL},
  2130.    {"printer name",     P_STRING,  P_LOCAL,  &sDefault.szPrintername,    NULL},
  2131.    {"hosts allow",      P_STRING,  P_LOCAL,  &sDefault.szHostsallow,     NULL},
  2132. @@ -666,6 +672,8 @@
  2133.  FN_LOCAL_STRING(lp_printcommand,szPrintcommand)
  2134.  FN_LOCAL_STRING(lp_lpqcommand,szLpqcommand)
  2135.  FN_LOCAL_STRING(lp_lprmcommand,szLprmcommand)
  2136. +FN_LOCAL_STRING(lp_lppausecommand,szLppausecommand)
  2137. +FN_LOCAL_STRING(lp_lpresumecommand,szLpresumecommand)
  2138.  FN_LOCAL_STRING(lp_printername,szPrintername)
  2139.  FN_LOCAL_STRING(lp_hostsallow,szHostsallow)
  2140.  FN_LOCAL_STRING(lp_hostsdeny,szHostsdeny)
  2141. diff -u -r --new-file last-version/source/loadparm.h samba-1.9.14alpha17/source/loadparm.h
  2142. --- last-version/source/loadparm.h    Tue Jul 11 15:49:06 1995
  2143. +++ samba-1.9.14alpha17/source/loadparm.h    Fri Sep 15 17:58:30 1995
  2144. @@ -94,6 +94,8 @@
  2145.  extern char *lp_printcommand(int iService);
  2146.  extern char *lp_lpqcommand(int iService);
  2147.  extern char *lp_lprmcommand(int iService);
  2148. +extern char *lp_lppausecommand(int iService);
  2149. +extern char *lp_lpresumecommand(int iService);
  2150.  extern char *lp_printername(int iService);
  2151.  extern char *lp_hostsallow(int iService);
  2152.  extern char *lp_hostsdeny(int iService);
  2153. diff -u -r --new-file last-version/source/local.h samba-1.9.14alpha17/source/local.h
  2154. --- last-version/source/local.h    Tue Sep 12 19:50:43 1995
  2155. +++ samba-1.9.14alpha17/source/local.h    Thu Sep 14 10:32:52 1995
  2156. @@ -73,6 +73,8 @@
  2157.     NOTE: This also slows down the server considerably */
  2158.  #define REDUCE_PATHS
  2159.  
  2160. +/* the size of the directory cache */
  2161. +#define DIRCACHESIZE 20
  2162.  
  2163.  /* what type of filesystem do we want this to show up as in a NT file
  2164.     manager window? */
  2165. diff -u -r --new-file last-version/source/mangle.c samba-1.9.14alpha17/source/mangle.c
  2166. --- last-version/source/mangle.c    Tue Sep 12 22:04:26 1995
  2167. +++ samba-1.9.14alpha17/source/mangle.c    Fri Sep 15 20:34:00 1995
  2168. @@ -536,11 +536,7 @@
  2169.  BOOL name_convert(char *OutName,char *InName,BOOL need83,int snum)
  2170.  {
  2171.    /* initially just copy it */
  2172. -#ifdef KANJI
  2173. -  strcpy(OutName, kj_dos_format (InName, False));
  2174. -#else
  2175.    strcpy(OutName,unix2dos_format(InName,False));
  2176. -#endif
  2177.  
  2178.    /* apply any name mappings */
  2179.    {
  2180. diff -u -r --new-file last-version/source/password.c samba-1.9.14alpha17/source/password.c
  2181. --- last-version/source/password.c    Sun Sep 10 23:10:06 1995
  2182. +++ samba-1.9.14alpha17/source/password.c    Thu Sep 14 13:05:11 1995
  2183. @@ -59,14 +59,13 @@
  2184.  {
  2185.    if (!challenge_sent) return(False);
  2186.    memcpy(challenge,saved_challenge,8);
  2187. -/*   challenge_sent = False; */
  2188.    return(True);
  2189.  }
  2190.  #endif
  2191.  
  2192.  /* this holds info on user ids that are already validated for this VC */
  2193. -user_struct *validated_users = NULL;
  2194. -int num_validated_users = 0;
  2195. +static user_struct *validated_users = NULL;
  2196. +static int num_validated_users = 0;
  2197.  
  2198.  /****************************************************************************
  2199.  check if a uid has been validated, and return an index if it has. -1 if not
  2200. @@ -79,7 +78,8 @@
  2201.    for (i=0;i<num_validated_users;i++)
  2202.      if (validated_users[i].uid == uid)
  2203.        {
  2204. -    DEBUG(3,("valid uid %d mapped to vuid %d\n",uid,i));
  2205. +    DEBUG(3,("valid uid %d mapped to vuid %d (user=%s)\n",
  2206. +         uid,i,validated_users[i].name));
  2207.      return(i);
  2208.        }
  2209.    return(-1);
  2210. @@ -89,7 +89,6 @@
  2211.  check if a uid has been validated, and return an pointer to the user_struct
  2212.  if it has. NULL if not
  2213.  ****************************************************************************/
  2214. -
  2215.  user_struct *get_valid_user_struct(int uid)
  2216.  {
  2217.    int vuid = valid_uid(uid);
  2218. @@ -107,19 +106,17 @@
  2219.    for (i=0;i<num_validated_users;i++)
  2220.      if (validated_users[i].uid == uid)
  2221.        {
  2222. -      user_struct *vuser = &validated_users[i];
  2223. -      vuser->uid = -1;
  2224. -      vuser->gid = -1;
  2225. -      vuser->user_ngroups = 0;
  2226. -      if(vuser->user_groups && (vuser->user_groups != (gid_t *)vuser->user_igroups))
  2227. -    free(vuser->user_groups);
  2228. -      vuser->user_groups = NULL;
  2229. -      if(vuser->user_igroups)
  2230. -    free(vuser->user_igroups);
  2231. -      vuser->user_igroups = NULL;
  2232. +    user_struct *vuser = &validated_users[i];
  2233. +    vuser->uid = -1;
  2234. +    vuser->gid = -1;
  2235. +    vuser->user_ngroups = 0;
  2236. +    if(vuser->user_groups && (vuser->user_groups != (gid_t *)vuser->user_igroups))
  2237. +      free(vuser->user_groups);
  2238. +    vuser->user_groups = NULL;
  2239. +    if(vuser->user_igroups)
  2240. +      free(vuser->user_igroups);
  2241. +    vuser->user_igroups = NULL;
  2242.        }
  2243. -
  2244. -  return;
  2245.  }
  2246.  
  2247.  
  2248. diff -u -r --new-file last-version/source/printing.c samba-1.9.14alpha17/source/printing.c
  2249. --- last-version/source/printing.c    Thu Jul  6 17:48:00 1995
  2250. +++ samba-1.9.14alpha17/source/printing.c    Fri Sep 15 20:51:06 1995
  2251. @@ -25,9 +25,30 @@
  2252.  extern connection_struct Connections[];
  2253.  extern files_struct Files[];
  2254.  
  2255. -BOOL lpq_cache_reset = False;
  2256. +/*BOOL lpq_cache_reset = False;*/
  2257.  
  2258. +static BOOL * lpq_cache_reset=NULL;
  2259.  
  2260. +static int check_lpq_cache(int snum) {
  2261. +  static int lpq_caches=0;
  2262. +  
  2263. +  if (lpq_caches <= snum) {
  2264. +      BOOL * p;
  2265. +      p = (BOOL *) realloc(lpq_cache_reset,(snum+1)*sizeof(BOOL));
  2266. +      if (p) {
  2267. +     lpq_cache_reset=p;
  2268. +     lpq_caches = snum+1;
  2269. +      }
  2270. +  }
  2271. +  return lpq_caches;
  2272. +}
  2273. +
  2274. +void lpq_reset(int snum)
  2275. +{
  2276. +  if (check_lpq_cache(snum) > snum) lpq_cache_reset[snum]=True;
  2277. +}
  2278. +
  2279. +
  2280.  /****************************************************************************
  2281.  Build the print command in the supplied buffer. This means getting the
  2282.  print command for the service and inserting the printer name and the
  2283. @@ -99,19 +120,18 @@
  2284.  {
  2285.    pstring syscmd;
  2286.    int cnum = Files[fnum].cnum;
  2287. +  int snum=SNUM(cnum);
  2288.    char *tempstr;
  2289.  
  2290. -  lpq_cache_reset = True;
  2291. -
  2292.    *syscmd = 0;
  2293.  
  2294.    if (file_size(Files[fnum].name) <= 0) {
  2295.      DEBUG(3,("Discarding null print job %s\n",Files[fnum].name));
  2296. -    unlink(Files[fnum].name);
  2297. +    sys_unlink(Files[fnum].name);
  2298.      return;
  2299.    }
  2300.  
  2301. -  tempstr = build_print_command(cnum, PRINTCOMMAND(SNUM(cnum)), syscmd, Files[fnum].name);
  2302. +  tempstr = build_print_command(cnum, PRINTCOMMAND(snum), syscmd, Files[fnum].name);
  2303.    if (tempstr != NULL)
  2304.      {
  2305.        int ret = smbrun(syscmd,NULL);
  2306. @@ -119,6 +139,8 @@
  2307.      }
  2308.    else
  2309.      DEBUG(0,("Null print command?\n"));
  2310. +  
  2311. +  lpq_reset(snum);
  2312.  }
  2313.  
  2314.  
  2315. @@ -216,6 +238,7 @@
  2316.    buf->job = atoi(tok[2]);
  2317.    buf->size = atoi(tok[4]);
  2318.    buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED;
  2319. +  buf->priority = 0;
  2320.    buf->time = time(NULL);
  2321.    StrnCpy(buf->user,tok[1],sizeof(buf->user)-1);
  2322.    StrnCpy(buf->file,tok[3],sizeof(buf->file)-1);
  2323. @@ -274,6 +297,7 @@
  2324.  
  2325.            buf->job = atoi(tok[1]);
  2326.            buf->status = LPQ_QUEUED;
  2327. +      buf->priority = 0;
  2328.            buf->time = time(NULL);
  2329.            StrnCpy(buf->user,tok[3],sizeof(buf->user)-1);
  2330.            StrnCpy(buf->file,tok[2],sizeof(buf->file)-1);
  2331. @@ -307,6 +331,7 @@
  2332.  
  2333.        buf->job = atoi(tok[3]);
  2334.        buf->status = strequal(tok[2],"RUNNING")?LPQ_PRINTING:LPQ_QUEUED;
  2335. +      buf->priority = 0;
  2336.        buf->time = time(NULL);
  2337.        StrnCpy(buf->user,tok[5],sizeof(buf->user)-1);
  2338.        StrnCpy(buf->file,tok[4],sizeof(buf->file)-1);
  2339. @@ -320,29 +345,38 @@
  2340.  /****************************************************************************
  2341.  parse a lpq line
  2342.  here is an example of lpq output under hpux; note there's no space after -o !
  2343. -navier> lpstat -oljplus
  2344. -ljplus-2153         user           priority 0  Jan 19 08:14
  2345. +$> lpstat -oljplus
  2346. +ljplus-2153         user           priority 0  Jan 19 08:14 on ljplus
  2347.        util.c                                  125697 bytes
  2348.        server.c                      110712 bytes
  2349. -ljplus-2154         user           priority 0  Jan 19 08:14
  2350. +ljplus-2154         user           priority 0  Jan 19 08:14 from client
  2351.        (standard input)                          7551 bytes
  2352.  ****************************************************************************/
  2353.  static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
  2354.  {
  2355.    /* must read two lines to process, therefore keep some values static */
  2356. -  static BOOL header_line_ok=False;
  2357. +  static BOOL header_line_ok=False, base_prio_reset=False;
  2358.    static string jobuser;
  2359.    static int jobid;
  2360. +  static int jobprio;
  2361.    static time_t jobtime;
  2362.    static int jobstat=LPSTAT_OK;
  2363. +  /* to store minimum priority to print, lpstat command should be invoked
  2364. +     with -p option first, to work */
  2365. +  static int base_prio;
  2366.   
  2367.    int count;
  2368.    char TAB = '\011';  
  2369. -  string tok[8];
  2370. +  string tok[12];
  2371.  
  2372.    /* If a line begins with a horizontal TAB, it is a subline type */
  2373.    
  2374.    if (line[0] == TAB) { /* subline */
  2375. +    /* check if it contains the base priority */
  2376. +    if (!strncmp(line,"\tfence priority : ",18)) {
  2377. +       base_prio=atoi(&line[18]);
  2378. +       DEBUG(4, ("fence priority set at %d\n", base_prio));
  2379. +    }
  2380.      if (!header_line_ok) return (False); /* incorrect header line */
  2381.      /* handle the case of "(standard input)" as a filename */
  2382.      string_sub(line,"standard input","STDIN");
  2383. @@ -367,30 +401,48 @@
  2384.      buf->time = jobtime;
  2385.      buf->job = jobid;
  2386.      buf->status = jobstat;
  2387. +    buf->priority = jobprio;
  2388.      StrnCpy(buf->user,jobuser,sizeof(buf->user)-1);
  2389.      
  2390.      return(True);
  2391.    }
  2392.    else { /* header line */
  2393. -    jobstat = ((first)&&(strstr(line,"on"))? LPQ_PRINTING:LPQ_QUEUED);
  2394.      header_line_ok=False; /* reset it */
  2395. +    if (first) {
  2396. +       if (!base_prio_reset) {
  2397. +      base_prio=0; /* reset it */
  2398. +      base_prio_reset=True;
  2399. +       }
  2400. +    }
  2401. +    else if (base_prio) base_prio_reset=False;
  2402. +    
  2403.      /* handle the dash in the job id */
  2404.      string_sub(line,"-"," ");
  2405.      
  2406. -    for (count=0; count<8 && next_token(&line,tok[count],NULL); count++) ;
  2407. +    for (count=0; count<12 && next_token(&line,tok[count],NULL); count++) ;
  2408.        
  2409. -    /* we must get 8 tokens for time calculation, otherwise 3 will do */
  2410. -    if (count < 3) return(False);
  2411. +    /* we must get 8 tokens */
  2412. +    if (count < 8) return(False);
  2413.      
  2414.      /* first token must be printer name (cannot check ??) */
  2415. -    /* the 2nd column must be integer */
  2416. -    if (!isdigit(*tok[1])) return(False);
  2417. -        
  2418. -    /* process time */
  2419. -    jobtime=EntryTime(tok, 5, count, 8);
  2420. -
  2421. +    /* the 2nd, 5th & 7th column must be integer */
  2422. +    if (!isdigit(*tok[1]) || !isdigit(*tok[4]) || !isdigit(*tok[6])) return(False);
  2423.      jobid = atoi(tok[1]);
  2424.      StrnCpy(jobuser,tok[2],sizeof(buf->user)-1);
  2425. +    jobprio = atoi(tok[4]);
  2426. +    
  2427. +    /* process time */
  2428. +    jobtime=EntryTime(tok, 5, count, 8);
  2429. +    if (jobprio < base_prio) {
  2430. +       jobstat = LPQ_PAUSED;
  2431. +       DEBUG (4, ("job %d is paused: prio %d < %d; jobstat=%d\n", jobid, jobprio, base_prio, jobstat));
  2432. +    }
  2433. +    else {
  2434. +       jobstat = LPQ_QUEUED;
  2435. +       if ((strequal(tok[8],"on")) ||
  2436. +       ((strequal(tok[8],"from")) && (strequal(tok[10],"on"))))
  2437. +      jobstat = LPQ_PRINTING;
  2438. +    }
  2439.      
  2440.      header_line_ok=True; /* information is correct */
  2441.      return(False); /* need subline info to include into queuelist */
  2442. @@ -437,6 +489,7 @@
  2443.    buf->job = atoi(tok[1]);
  2444.    buf->size = atoi(tok[3]);
  2445.    buf->status = strequal(tok[7],"on")?LPQ_PRINTING:LPQ_QUEUED;
  2446. +  buf->priority = 0;
  2447.    buf->time = EntryTime(tok, 4, count, 7);
  2448.    StrnCpy(buf->user,tok[2],sizeof(buf->user)-1);
  2449.    StrnCpy(buf->file,tok[2],sizeof(buf->file)-1);
  2450. @@ -486,28 +539,32 @@
  2451.    if (status && !ret)
  2452.      {
  2453.        /* a few simple checks to see if the line might be a
  2454. -         printer status line */
  2455. +         printer status line: 
  2456. +     handle them so that most severe condition is shown */
  2457.        int i;
  2458.        strlower(line);
  2459. -
  2460. -      for (i=0; stat0_strings[i]; i++)
  2461. -        if (strstr(line,stat0_strings[i])) {
  2462. -      StrnCpy(status->message,line,sizeof(status->message)-1);
  2463. -      status->status=LPSTAT_OK;
  2464. -      return(ret);
  2465. -        }
  2466. -      for (i=0; stat1_strings[i]; i++)
  2467. -        if (strstr(line,stat1_strings[i])) {
  2468. -      StrnCpy(status->message,line,sizeof(status->message)-1);
  2469. -      status->status=LPSTAT_STOPPED;
  2470. -      return(ret);
  2471. -        }
  2472. -      for (i=0; stat2_strings[i]; i++)
  2473. -        if (strstr(line,stat2_strings[i])) {
  2474. -      StrnCpy(status->message,line,sizeof(status->message)-1);
  2475. -      status->status=LPSTAT_ERROR;
  2476. -      return(ret);
  2477. -        }
  2478. +      
  2479. +      switch (status->status) {
  2480. +      case LPSTAT_OK:
  2481. +    for (i=0; stat0_strings[i]; i++)
  2482. +      if (strstr(line,stat0_strings[i])) {
  2483. +        StrnCpy(status->message,line,sizeof(status->message)-1);
  2484. +        status->status=LPSTAT_OK;
  2485. +      }
  2486. +      case LPSTAT_STOPPED:
  2487. +    for (i=0; stat1_strings[i]; i++)
  2488. +      if (strstr(line,stat1_strings[i])) {
  2489. +        StrnCpy(status->message,line,sizeof(status->message)-1);
  2490. +        status->status=LPSTAT_STOPPED;
  2491. +      }
  2492. +      case LPSTAT_ERROR:
  2493. +    for (i=0; stat2_strings[i]; i++)
  2494. +      if (strstr(line,stat2_strings[i])) {
  2495. +        StrnCpy(status->message,line,sizeof(status->message)-1);
  2496. +        status->status=LPSTAT_ERROR;
  2497. +      }
  2498. +    break;
  2499. +      }
  2500.      }
  2501.  
  2502.    return(ret);
  2503. @@ -532,7 +589,8 @@
  2504.    int lfd = -1;
  2505.  
  2506.    *line = 0;
  2507. -
  2508. +  check_lpq_cache(snum);
  2509. +  
  2510.    if (!printername || !*printername)
  2511.      {
  2512.        DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n",
  2513. @@ -553,7 +611,7 @@
  2514.  
  2515.    sprintf(outfile,"/tmp/lpq.%08x",str_checksum(syscmd));
  2516.    
  2517. -  if (!lpq_cache_reset && cachetime && !stat(outfile,&sbuf)) 
  2518. +  if (!lpq_cache_reset[snum] && cachetime && !stat(outfile,&sbuf)) 
  2519.      {
  2520.        if (time(NULL) - sbuf.st_mtime < cachetime) {
  2521.      DEBUG(3,("Using cached lpq output\n"));
  2522. @@ -576,7 +634,7 @@
  2523.      DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
  2524.    }
  2525.  
  2526. -  lpq_cache_reset = False;
  2527. +  lpq_cache_reset[snum] = False;
  2528.  
  2529.    f = fopen(outfile,"r");
  2530.    if (!f) {
  2531. @@ -584,8 +642,10 @@
  2532.      return(0);
  2533.    }
  2534.  
  2535. -  if (status)
  2536. +  if (status) {
  2537.      strcpy(status->message,"");
  2538. +    status->status = LPSTAT_OK;
  2539. +  }
  2540.        
  2541.    while (fgets(line,sizeof(pstring),f))
  2542.      {
  2543. @@ -597,6 +657,8 @@
  2544.        count = 0;
  2545.        break;
  2546.      }
  2547. +
  2548. +      bzero((char *)(*queue),sizeof(**queue));
  2549.        
  2550.        /* parse it */
  2551.        if (!parse_lpq_entry(snum,line,&(*queue)[count],status,count==0))
  2552. @@ -650,7 +712,45 @@
  2553.  
  2554.    ret = smbrun(syscmd,NULL);
  2555.    DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));  
  2556. +  lpq_reset(snum); /* queue has changed */
  2557.  }
  2558.  
  2559. +/****************************************************************************
  2560. +change status of a printer queue entry
  2561. +****************************************************************************/
  2562. +void status_printjob(int cnum,int snum,int jobid,int status)
  2563. +{
  2564. +  char *lpstatus_command = 
  2565. +    (status==LPQ_PAUSED?lp_lppausecommand(snum):lp_lpresumecommand(snum));
  2566. +  char *printername = PRINTERNAME(snum);
  2567. +  pstring syscmd;
  2568. +  char jobstr[20];
  2569. +  int ret;
  2570. +
  2571. +  if (!printername || !*printername)
  2572. +    {
  2573. +      DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n",
  2574. +        lp_servicename(snum),snum));
  2575. +      printername = lp_servicename(snum);
  2576. +    }
  2577. +    
  2578. +  if (!lpstatus_command || !(*lpstatus_command))
  2579. +    {
  2580. +      DEBUG(5,("No lpstatus command to %s job\n",
  2581. +           (status==LPQ_PAUSED?"pause":"resume")));
  2582. +      return;
  2583. +    }
  2584. +    
  2585. +  sprintf(jobstr,"%d",jobid);
  2586. +
  2587. +  strcpy(syscmd,lpstatus_command);
  2588. +  string_sub(syscmd,"%p",printername);
  2589. +  string_sub(syscmd,"%j",jobstr);
  2590. +  standard_sub(cnum,syscmd);
  2591. +
  2592. +  ret = smbrun(syscmd,NULL);
  2593. +  DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));  
  2594. +  lpq_reset(snum); /* queue has changed */
  2595. +}
  2596.  
  2597.  
  2598. diff -u -r --new-file last-version/source/reply.c samba-1.9.14alpha17/source/reply.c
  2599. --- last-version/source/reply.c    Tue Sep 12 20:00:26 1995
  2600. +++ samba-1.9.14alpha17/source/reply.c    Fri Sep 15 21:53:20 1995
  2601. @@ -106,7 +106,32 @@
  2602.  }
  2603.  
  2604.  
  2605. +/*******************************************************************
  2606. +work out what error to give to a failed connection
  2607. +********************************************************************/
  2608. +static int connection_error(char *inbuf,char *outbuf,int connection_num)
  2609. +{
  2610. +  switch (connection_num)
  2611. +    {
  2612. +    case -8:
  2613. +      return(ERROR(ERRSRV,ERRnoresource));
  2614. +    case -7:
  2615. +      return(ERROR(ERRSRV,ERRbaduid));
  2616. +    case -6:
  2617. +      return(ERROR(ERRSRV,ERRinvdevice));
  2618. +    case -5:
  2619. +      return(ERROR(ERRDOS,ERRbadpath));
  2620. +    case -4:
  2621. +      return(ERROR(ERRSRV,ERRaccess));
  2622. +    case -3:
  2623. +      return(ERROR(ERRDOS,ERRnoipc));
  2624. +    case -2:
  2625. +      return(ERROR(ERRSRV,ERRinvnetname));
  2626. +    }
  2627. +  return(ERROR(ERRSRV,ERRbadpw));
  2628. +}
  2629.  
  2630. +
  2631.  /****************************************************************************
  2632.    reply to a tcon
  2633.  ****************************************************************************/
  2634. @@ -131,17 +156,7 @@
  2635.    connection_num = make_connection(service,user,password,pwlen,dev,vuid);
  2636.    
  2637.    if (connection_num < 0)
  2638. -    switch (connection_num)
  2639. -      {
  2640. -      case -4:
  2641. -    return(ERROR(ERRSRV,ERRaccess));
  2642. -      case -3:
  2643. -    return(ERROR(ERRDOS,ERRnoipc));
  2644. -      case -2:
  2645. -    return(ERROR(ERRSRV,ERRinvnetname));
  2646. -      default:
  2647. -    return(ERROR(ERRSRV,ERRbadpw));
  2648. -      }
  2649. +    return(connection_error(inbuf,outbuf,connection_num));
  2650.    
  2651.    outsize = set_message(outbuf,2,0,True);
  2652.    SSVAL(outbuf,smb_vwv0,maxxmit);
  2653. @@ -205,18 +220,8 @@
  2654.    connection_num = make_connection(service,user,password,passlen,devicename,vuid);
  2655.    
  2656.    if (connection_num < 0)
  2657. -    switch (connection_num)
  2658. -      {
  2659. -      case -4:
  2660. -    return(ERROR(ERRSRV,ERRaccess));
  2661. -      case -3:
  2662. -    return(ERROR(ERRDOS,ERRnoipc));
  2663. -      case -2:
  2664. -    return(ERROR(ERRSRV,ERRinvnetname));
  2665. -      default:
  2666. -    return(ERROR(ERRSRV,ERRbadpw));
  2667. -      }
  2668. -  
  2669. +    return(connection_error(inbuf,outbuf,connection_num));
  2670. +
  2671.    outsize = set_message(outbuf,2,strlen(devicename)+1,True);
  2672.    
  2673.    DEBUG(3,("%s tconX service=%s user=%s cnum=%d\n",timestring(),service,user,connection_num));
  2674. @@ -490,7 +495,7 @@
  2675.    else
  2676.      if (check_name(fname,cnum))
  2677.        {
  2678. -    if (stat(fname,&sbuf) == 0)
  2679. +    if (sys_stat(fname,&sbuf) == 0)
  2680.        {
  2681.          mode = dos_mode(cnum,fname,&sbuf);
  2682.          size = sbuf.st_size;
  2683. @@ -575,7 +580,7 @@
  2684.    
  2685.    cnum = SVAL(inbuf,smb_tid);
  2686.    
  2687. -  disk_free(".",&bsize,&dfree,&dsize);
  2688. +  sys_disk_free(".",&bsize,&dfree,&dsize);
  2689.    
  2690.    outsize = set_message(outbuf,5,0,True);
  2691.    
  2692. @@ -1147,7 +1152,7 @@
  2693.    struct stat sbuf;
  2694.    int fmode;
  2695.  
  2696. -  if (lstat(fname,&sbuf) != 0) return(False);
  2697. +  if (sys_lstat(fname,&sbuf) != 0) return(False);
  2698.    fmode = dos_mode(cnum,fname,&sbuf);
  2699.    if (fmode & aDIR) return(False);
  2700.    if (fmode & aRONLY) return(False);
  2701. @@ -1201,7 +1206,7 @@
  2702.    if (!has_wild) {
  2703.      strcat(directory,"/");
  2704.      strcat(directory,mask);
  2705. -    if (can_delete(directory,cnum,dirtype) && !unlink(directory)) count++;
  2706. +    if (can_delete(directory,cnum,dirtype) && !sys_unlink(directory)) count++;
  2707.    } else {
  2708.      void *dirptr = NULL;
  2709.      char *dname;
  2710. @@ -1226,7 +1231,7 @@
  2711.          error = ERRnoaccess;
  2712.          sprintf(fname,"%s/%s",directory,dname);
  2713.          if (!can_delete(fname,cnum,dirtype)) continue;
  2714. -        if (!unlink(fname)) count++;
  2715. +        if (!sys_unlink(fname)) count++;
  2716.          DEBUG(3,("reply_unlink : doing unlink on %s\n",fname));
  2717.        }
  2718.      CloseDir(dirptr);
  2719. @@ -2311,7 +2316,7 @@
  2720.    unix_convert(directory,cnum);
  2721.    
  2722.    if (check_name(directory,cnum))
  2723. -    ret = mkdir(directory,unix_mode(cnum,aDIR));
  2724. +    ret = sys_mkdir(directory,unix_mode(cnum,aDIR));
  2725.    
  2726.    if (ret < 0)
  2727.      return(UNIXERROR(ERRDOS,ERRnoaccess));
  2728. @@ -2341,7 +2346,7 @@
  2729.    if (check_name(directory,cnum))
  2730.      {
  2731.        dptr_closepath(directory,SVAL(inbuf,smb_pid));
  2732. -      ok = (rmdir(directory) == 0);
  2733. +      ok = (sys_rmdir(directory) == 0);
  2734.        if (!ok)
  2735.      DEBUG(3,("couldn't remove directory %s : %s\n",
  2736.           directory,strerror(errno)));
  2737. @@ -2430,7 +2435,7 @@
  2738.    struct stat sbuf;
  2739.    int fmode;
  2740.  
  2741. -  if (lstat(fname,&sbuf) != 0) return(False);
  2742. +  if (sys_lstat(fname,&sbuf) != 0) return(False);
  2743.    fmode = dos_mode(cnum,fname,&sbuf);
  2744.    if (fmode & aRONLY) return(False);
  2745.    return(True);
  2746. @@ -2912,7 +2917,7 @@
  2747.    unix_times.modtime += LOCAL_TO_GMT*TimeDiff(unix_times.modtime);
  2748.    
  2749.    /* Set the date on this file */
  2750. -  if(utime(Files[fnum].name, &unix_times))
  2751. +  if(sys_utime(Files[fnum].name, &unix_times))
  2752.      return(ERROR(ERRDOS,ERRnoaccess));
  2753.    
  2754.    DEBUG(3,("%s reply_setattrE fnum=%d cnum=%d\n",timestring(),fnum,cnum));
  2755. diff -u -r --new-file last-version/source/server.c samba-1.9.14alpha17/source/server.c
  2756. --- last-version/source/server.c    Wed Sep 13 23:04:22 1995
  2757. +++ samba-1.9.14alpha17/source/server.c    Fri Sep 15 21:38:57 1995
  2758. @@ -77,9 +77,6 @@
  2759.  /* a fnum to use when chaining */
  2760.  int chain_fnum = -1;
  2761.  
  2762. -/* what cnum we are currently working with */
  2763. -int current_cnum = -1;
  2764. -
  2765.  /* number of open connections */
  2766.  static int num_connections_open = 0;
  2767.  
  2768. @@ -204,7 +201,7 @@
  2769.    int tmp;
  2770.    int unixmode;
  2771.  
  2772. -  if (stat(fname,&st)) return(-1);
  2773. +  if (sys_stat(fname,&st)) return(-1);
  2774.  
  2775.    if (S_ISDIR(st.st_mode)) dosmode |= aDIR;
  2776.  
  2777. @@ -304,16 +301,24 @@
  2778.  
  2779.  If the name looks like a mangled name then try via the mangling functions
  2780.  ****************************************************************************/
  2781. -static BOOL scan_directory(char *path, char *name,int snum)
  2782. +static BOOL scan_directory(char *path, char *name,int snum,BOOL docache)
  2783.  {
  2784.    void *cur_dir;
  2785.    char *dname;
  2786. -  BOOL mangled = is_mangled(name);
  2787. +  BOOL mangled;
  2788. +  fstring name2;
  2789. +
  2790. +  mangled = is_mangled(name);
  2791.  
  2792.    /* handle null paths */
  2793.    if (*path == 0)
  2794.      path = ".";
  2795.  
  2796. +  if (docache && (dname = DirCacheCheck(path,name,snum))) {
  2797. +    strcpy(name, dname);    
  2798. +    return(True);
  2799. +  }      
  2800. +
  2801.    if (mangled)
  2802.      check_mangled_stack(name);
  2803.  
  2804. @@ -327,8 +332,6 @@
  2805.    /* now scan for matching names */
  2806.    while ((dname = ReadDirName(cur_dir))) 
  2807.      {
  2808. -      fstring name2;
  2809. -
  2810.        if (*dname == '.' &&
  2811.        (strequal(dname,".") || strequal(dname,"..")))
  2812.      continue;
  2813. @@ -339,6 +342,7 @@
  2814.        || fname_equal(name, name2))
  2815.      {
  2816.        /* we've found the file, change it's name and return */
  2817. +      if (docache) DirCacheAdd(path,name,dname,snum);
  2818.        strcpy(name, dname);
  2819.        CloseDir(cur_dir);
  2820.        return(True);
  2821. @@ -393,7 +397,7 @@
  2822.      }
  2823.  
  2824.    /* stat the name - if it exists then we are all done! */
  2825. -  if (stat(name,&st) == 0)
  2826. +  if (sys_stat(name,&st) == 0)
  2827.      return(True);
  2828.  
  2829.    DEBUG(5,("unix_convert(%s,%d)\n",name,cnum));
  2830. @@ -422,7 +426,7 @@
  2831.        if (end) *end = 0;
  2832.  
  2833.        /* check if the name exists up to this point */
  2834. -      if (stat(name, &st) == 0) 
  2835. +      if (sys_stat(name, &st) == 0) 
  2836.      {
  2837.        /* it exists. it must either be a directory or this must be
  2838.           the last part of the path for it to be OK */
  2839. @@ -447,7 +451,7 @@
  2840.  
  2841.        /* try to find this part of the path in the directory */
  2842.        if (strchr(start,'?') || strchr(start,'*') ||
  2843. -          !scan_directory(dirpath, start, SNUM(cnum)))
  2844. +          !scan_directory(dirpath, start, SNUM(cnum), end?True:False))
  2845.          {
  2846.            if (end) 
  2847.          {
  2848. @@ -498,6 +502,328 @@
  2849.  
  2850.  
  2851.  
  2852. +
  2853. +#ifdef QUOTAS
  2854. +#ifndef CRAY
  2855. +/****************************************************************************
  2856. +try to get the disk space from disk quotas
  2857. +****************************************************************************/
  2858. +static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
  2859. +{
  2860. +  uid_t user_id, euser_id;
  2861. +  int r;
  2862. +  char dev_disk[256];
  2863. +  struct dqblk D;
  2864. +  struct stat S;
  2865. +  /* find the block device file */
  2866. +  if ((stat(path, &S)<0) ||
  2867. +      (devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
  2868. +
  2869. +  euser_id = geteuid();
  2870. +
  2871. +#ifdef USE_SETRES
  2872. +  /* for HPUX, real uid must be same as euid to execute quotactl for euid */
  2873. +  user_id = getuid();
  2874. +  setresuid(euser_id,-1,-1);
  2875. +#endif
  2876. +  r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
  2877. +  #ifdef USE_SETRES
  2878. +  if (setresuid(user_id,-1,-1))
  2879. +    DEBUG(5,("Unable to reset uid to %d\n", user_id));
  2880. +  #endif
  2881. +  /* Use softlimit to determine disk space, except when it has been exceeded */
  2882. +  *bsize = 1024;
  2883. +  if (r)
  2884. +    {
  2885. +      if (errno == EDQUOT) 
  2886. +    {
  2887. +       *dfree =0;
  2888. +       *dsize =D.dqb_curblocks;
  2889. +       return (True);
  2890. +    }
  2891. +      else return(False);
  2892. +    }
  2893. +  /* Use softlimit to determine disk space, except when it has been exceeded */
  2894. +  if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curfiles>D.dqb_fsoftlimit)) 
  2895. +    {
  2896. +      *dfree = 0;
  2897. +      *dsize = D.dqb_curblocks;
  2898. +    }
  2899. +  else {
  2900. +    *dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
  2901. +    *dsize = D.dqb_bsoftlimit;
  2902. +  }
  2903. +  return (True);
  2904. +}
  2905. +#else
  2906. +/****************************************************************************
  2907. +try to get the disk space from disk quotas (CRAY VERSION)
  2908. +****************************************************************************/
  2909. +static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
  2910. +{
  2911. +  struct mntent *mnt;
  2912. +  FILE *fd;
  2913. +  struct stat sbuf;
  2914. +  dev_t devno ;
  2915. +  static dev_t devno_cached = 0 ;
  2916. +  static char name[MNTMAXSTR] ;
  2917. +  struct q_request request ;
  2918. +  struct qf_header header ;
  2919. +  static int quota_default = 0 ;
  2920. +  int found ;
  2921. +  
  2922. +  if ( stat(path,&sbuf) == -1 )
  2923. +    return(False) ;
  2924. +  
  2925. +  devno = sbuf.st_dev ;
  2926. +  
  2927. +  if ( devno != devno_cached ) {
  2928. +    
  2929. +    devno_cached = devno ;
  2930. +    
  2931. +    if ((fd = setmntent(KMTAB)) == NULL)
  2932. +      return(False) ;
  2933. +    
  2934. +    found = False ;
  2935. +    
  2936. +    while ((mnt = getmntent(fd)) != NULL) {
  2937. +      
  2938. +      if ( stat(mnt->mnt_dir,&sbuf) == -1 )
  2939. +    continue ;
  2940. +      
  2941. +      if (sbuf.st_dev == devno) {
  2942. +    
  2943. +    found = True ;
  2944. +    break ;
  2945. +    
  2946. +      }
  2947. +      
  2948. +    }
  2949. +    
  2950. +    strcpy(name,mnt->mnt_dir) ;
  2951. +    endmntent(fd) ;
  2952. +    
  2953. +    if ( ! found )
  2954. +      return(False) ;
  2955. +  }
  2956. +  
  2957. +  request.qf_magic = QF_MAGIC ;
  2958. +  request.qf_entry.id = geteuid() ;
  2959. +  
  2960. +  if (quotactl(name, Q_GETQUOTA, &request) == -1)
  2961. +    return(False) ;
  2962. +  
  2963. +  if ( ! request.user )
  2964. +    return(False) ;
  2965. +  
  2966. +  if ( request.qf_entry.user_q.f_quota == QFV_DEFAULT ) {
  2967. +    
  2968. +    if ( ! quota_default ) {
  2969. +      
  2970. +      if ( quotactl(name, Q_GETHEADER, &header) == -1 )
  2971. +    return(False) ;
  2972. +      else
  2973. +    quota_default = header.user_h.def_fq ;
  2974. +    }
  2975. +    
  2976. +    *dfree = quota_default ;
  2977. +    
  2978. +  }else if ( request.qf_entry.user_q.f_quota == QFV_PREVENT ) {
  2979. +    
  2980. +    *dfree = 0 ;
  2981. +    
  2982. +  }else{
  2983. +    
  2984. +    *dfree = request.qf_entry.user_q.f_quota ;
  2985. +    
  2986. +  }
  2987. +  
  2988. +  *dsize = request.qf_entry.user_q.f_use ;
  2989. +  
  2990. +  if ( *dfree )
  2991. +    *dfree -= *dsize ;
  2992. +  
  2993. +  if ( *dfree < 0 )
  2994. +    *dfree = 0 ;
  2995. +  
  2996. +  *bsize = 4096 ;  /* Cray blocksize */
  2997. +  
  2998. +  return(True) ;
  2999. +  
  3000. +}
  3001. +#endif /* CRAY */
  3002. +#endif /* QUOTAS */
  3003. +
  3004. +
  3005. +/****************************************************************************
  3006. +normalise for DOS usage 
  3007. +****************************************************************************/
  3008. +static void disk_norm(int *bsize,int *dfree,int *dsize)
  3009. +{
  3010. +  /* check if the disk is beyond the max disk size */
  3011. +  int maxdisksize = lp_maxdisksize();
  3012. +  if (maxdisksize) {
  3013. +    /* convert to blocks - and don't overflow */
  3014. +    maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
  3015. +    if (*dsize > maxdisksize) *dsize = maxdisksize;
  3016. +    if (*dfree > maxdisksize) *dfree = maxdisksize-1; /* the -1 should stop 
  3017. +                             applications getting 
  3018. +                             div by 0 errors */
  3019. +  }  
  3020. +
  3021. +  while (*dfree > WORDMAX || *dsize > WORDMAX || *bsize < 512) 
  3022. +    {
  3023. +      *dfree /= 2;
  3024. +      *dsize /= 2;
  3025. +      *bsize *= 2;
  3026. +      if (*bsize > WORDMAX )
  3027. +    {
  3028. +      *bsize = WORDMAX;
  3029. +      if (*dsize > WORDMAX)
  3030. +        *dsize = WORDMAX;
  3031. +      if (*dfree >  WORDMAX)
  3032. +        *dfree = WORDMAX;
  3033. +      break;
  3034. +    }
  3035. +    }
  3036. +}
  3037. +
  3038. +/****************************************************************************
  3039. +  return number of 1K blocks available on a path and total number 
  3040. +****************************************************************************/
  3041. +int disk_free(char *path,int *bsize,int *dfree,int *dsize)
  3042. +{
  3043. +  char *df_command = lp_dfree_command();
  3044. +#ifdef USE_STATVFS
  3045. +  struct statvfs fs;
  3046. +#else
  3047. +#ifdef ULTRIX
  3048. +  struct fs_data fs;
  3049. +#else
  3050. +  struct statfs fs;
  3051. +#endif
  3052. +#endif
  3053. +
  3054. +#ifdef QUOTAS
  3055. +  if (disk_quotas(path, bsize, dfree, dsize))
  3056. +    {
  3057. +      disk_norm(bsize,dfree,dsize);
  3058. +      return(((*bsize)/1024)*(*dfree));
  3059. +    }
  3060. +#endif
  3061. +
  3062. +
  3063. +  /* possibly use system() to get the result */
  3064. +  if (df_command && *df_command)
  3065. +    {
  3066. +      int ret;
  3067. +      pstring syscmd;
  3068. +      pstring outfile;
  3069. +      
  3070. +      sprintf(outfile,"/tmp/dfree.smb.%d",(int)getpid());
  3071. +      sprintf(syscmd,"%s %s",df_command,path);
  3072. +      standard_sub_basic(syscmd);
  3073. +
  3074. +      ret = smbrun(syscmd,outfile);
  3075. +      DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
  3076. +      
  3077. +      {
  3078. +    FILE *f = fopen(outfile,"r");    
  3079. +    *dsize = 0;
  3080. +    *dfree = 0;
  3081. +    *bsize = 1024;
  3082. +    if (f)
  3083. +      {
  3084. +        fscanf(f,"%d %d %d",dsize,dfree,bsize);
  3085. +        fclose(f);
  3086. +      }
  3087. +    else
  3088. +      DEBUG(0,("Can't open %s\n",outfile));
  3089. +      }
  3090. +      
  3091. +      unlink(outfile);
  3092. +      disk_norm(bsize,dfree,dsize);
  3093. +      return(((*bsize)/1024)*(*dfree));
  3094. +    }
  3095. +
  3096. +
  3097. +#ifdef STATFS4
  3098. +  if (statfs(path,&fs,sizeof(fs),0) != 0)
  3099. +#else
  3100. +#ifdef USE_STATVFS
  3101. +    if (statvfs(path, &fs))
  3102. +#else
  3103. +#ifdef STATFS3
  3104. +      if (statfs(path,&fs,sizeof(fs)) == -1)     
  3105. +#else
  3106. +    if (statfs(path,&fs) == -1)
  3107. +#endif /* STATFS3 */
  3108. +#endif /* USE_STATVFS */
  3109. +#endif /* STATFS4 */
  3110. +      {
  3111. +        DEBUG(3,("dfree call failed code errno=%d\n",errno));
  3112. +        *bsize = 1024;
  3113. +        *dfree = 1;
  3114. +        *dsize = 1;
  3115. +        return(((*bsize)/1024)*(*dfree));
  3116. +      }
  3117. +
  3118. +#ifdef ULTRIX
  3119. +  *bsize = 1024;
  3120. +  *dfree = fs.fd_req.bfree;
  3121. +  *dsize = fs.fd_req.btot;
  3122. +#else
  3123. +#ifdef USE_STATVFS
  3124. +  *bsize = fs.f_frsize;
  3125. +#else
  3126. +#ifdef USE_F_FSIZE
  3127. +  /* eg: osf1 has f_fsize = fundamental filesystem block size, 
  3128. +     f_bsize = optimal transfer block size (MX: 94-04-19) */
  3129. +  *bsize = fs.f_fsize;
  3130. +#else
  3131. +  *bsize = fs.f_bsize;
  3132. +#endif /* STATFS3 */
  3133. +#endif /* USE_STATVFS */
  3134. +
  3135. +#ifdef STATFS4
  3136. +  *dfree = fs.f_bfree;
  3137. +#else
  3138. +  *dfree = fs.f_bavail;
  3139. +#endif /* STATFS4 */
  3140. +  *dsize = fs.f_blocks;
  3141. +#endif /* ULTRIX */
  3142. +
  3143. +#if defined(SCO) || defined(ISC) || defined(MIPS)
  3144. +  *bsize = 512;
  3145. +#endif
  3146. +
  3147. +/* handle rediculous bsize values - some OSes are broken */
  3148. +if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024;
  3149. +
  3150. +  disk_norm(bsize,dfree,dsize);
  3151. +
  3152. +  if (*bsize < 256)
  3153. +    *bsize = 512;
  3154. +  if ((*dsize)<1)
  3155. +    {
  3156. +      DEBUG(0,("dfree seems to be broken on your system\n"));
  3157. +      *dsize = 20*1024*1024/(*bsize);
  3158. +      *dfree = MAX(1,*dfree);
  3159. +    }
  3160. +  return(((*bsize)/1024)*(*dfree));
  3161. +}
  3162. +
  3163. +
  3164. +/****************************************************************************
  3165. +wrap it to get filenames right
  3166. +****************************************************************************/
  3167. +int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize)
  3168. +{
  3169. +  return(disk_free(dos_to_unix(path,False),bsize,dfree,dsize));
  3170. +}
  3171. +
  3172. +
  3173. +
  3174.  /****************************************************************************
  3175.  check a filename - possibly caling reducename
  3176.  
  3177. @@ -569,11 +895,11 @@
  3178.    /* XXXX - is this OK?? */
  3179.    /* this works around a utime bug but can cause other problems */
  3180.    if ((flags & (O_WRONLY|O_RDWR)) && (flags & O_CREAT) && !(flags & O_APPEND))
  3181. -    unlink(fname);
  3182. +    sys_unlink(fname);
  3183.  #endif
  3184.  
  3185.  
  3186. -  Files[fnum].fd = open(fname,flags,mode);
  3187. +  Files[fnum].fd = sys_open(fname,flags,mode);
  3188.  
  3189.    if ((Files[fnum].fd>=0) && 
  3190.        Connections[cnum].printer && lp_minprintspace(SNUM(cnum))) {
  3191. @@ -583,10 +909,11 @@
  3192.      strcpy(dname,fname);
  3193.      p = strrchr(dname,'/');
  3194.      if (p) *p = 0;
  3195. -    if (disk_free(dname,&dum1,&dum2,&dum3) < lp_minprintspace(SNUM(cnum))) {
  3196. +    if (sys_disk_free(dname,&dum1,&dum2,&dum3) < 
  3197. +    lp_minprintspace(SNUM(cnum))) {
  3198.        close(Files[fnum].fd);
  3199.        Files[fnum].fd = -1;
  3200. -      unlink(fname);
  3201. +      sys_unlink(fname);
  3202.        errno = ENOSPC;
  3203.        return;
  3204.      }
  3205. @@ -598,7 +925,7 @@
  3206.       (strchr(fname,'.')==NULL))
  3207.      {
  3208.        strcat(fname,".");
  3209. -      Files[fnum].fd = open(fname,flags,mode);
  3210. +      Files[fnum].fd = sys_open(fname,flags,mode);
  3211.      }
  3212.  
  3213.  #if (defined(ENAMETOOLONG) && defined(HAVE_PATHCONF))
  3214. @@ -629,7 +956,7 @@
  3215.        char tmp = p[max_len];
  3216.  
  3217.        p[max_len] = '\0';
  3218. -      if ((Files[fnum].fd = open(fname,flags,mode)) == -1)
  3219. +      if ((Files[fnum].fd = sys_open(fname,flags,mode)) == -1)
  3220.          p[max_len] = tmp;
  3221.      }
  3222.      }
  3223. @@ -1119,8 +1446,6 @@
  3224.  
  3225.    snum = SNUM(cnum);
  3226.    
  3227. -  current_cnum = cnum;
  3228. -
  3229.    if (do_chdir &&
  3230.        ChDir(Connections[cnum].connectpath) != 0 &&
  3231.        ChDir(Connections[cnum].origpath) != 0)
  3232. @@ -1297,6 +1622,7 @@
  3233.      if (!become_gid(gid_to_become))
  3234.        return(False);
  3235.            
  3236. +#ifndef NO_SETGROUPS
  3237.      if (!IS_IPC(cnum))
  3238.        {
  3239.        /* groups stuff added by ih/wreu */
  3240. @@ -1304,6 +1630,7 @@
  3241.          if (setgroups(vuser->user_ngroups,(GID_TYPE *)vuser->user_groups)<0)
  3242.            DEBUG(0,("setgroups call failed!\n"));
  3243.        }
  3244. +#endif
  3245.            
  3246.      if (!Connections[cnum].admin_user && !become_uid(vuser->uid))
  3247.        return(False);
  3248. @@ -1318,13 +1645,15 @@
  3249.          if (!become_gid(Connections[cnum].gid))
  3250.        return(False);
  3251.  
  3252. -        if (!IS_IPC(cnum))
  3253. +#ifndef NO_SETGROUPS      
  3254. +    if (!IS_IPC(cnum))
  3255.        {
  3256.          /* groups stuff added by ih/wreu */
  3257.          if (Connections[cnum].ngroups > 0)
  3258.            if (setgroups(Connections[cnum].ngroups,(GID_TYPE *)Connections[cnum].groups)<0)
  3259.              DEBUG(0,("setgroups call failed!\n"));
  3260.        }
  3261. +#endif
  3262.  
  3263.          if (!Connections[cnum].admin_user && !become_uid(Connections[cnum].uid))
  3264.        return(False);
  3265. @@ -1941,7 +2270,7 @@
  3266.            if (groups_use_ints)
  3267.              {
  3268.                *p_igroups = igroups;
  3269. -              *p_groups = (gid_t *)igroups;      
  3270. +              *p_groups = (GID_TYPE *)igroups;      
  3271.              }
  3272.            else
  3273.              {
  3274. @@ -1950,7 +2279,7 @@
  3275.            for (i=0;i<ngroups;i++)
  3276.              igroups[i] = groups[i];
  3277.            *p_igroups = igroups;
  3278. -          *p_groups = groups;                
  3279. +          *p_groups = (GID_TYPE *)groups;
  3280.          }
  3281.      }
  3282.        DEBUG(3,("%s is in %d groups\n",user,ngroups));
  3283. @@ -2001,7 +2330,7 @@
  3284.      }
  3285.  
  3286.    if (!lp_snum_ok(snum) || !check_access(snum))
  3287. -    return(-1);
  3288. +    return(-4);
  3289.  
  3290.    /* you can only connect to the IPC$ service as an ipc device */
  3291.    if (strequal(service,"IPC$"))
  3292. @@ -2018,7 +2347,7 @@
  3293.    /* if the request is as a printer and you can't print then refuse */
  3294.    strupper(dev);
  3295.    if (!lp_print_ok(snum) && (strncmp(dev,"LPT",3) == 0))
  3296. -    return(-2);
  3297. +    return(-6);
  3298.  
  3299.    /* lowercase the user name */
  3300.    strlower(user);
  3301. @@ -2048,7 +2377,7 @@
  3302.    if (pass == NULL)
  3303.      {
  3304.        DEBUG(0,("%s couldn't find account %s\n",timestring(),user)); 
  3305. -      return(-1);
  3306. +      return(-7);
  3307.      }
  3308.  
  3309.    pcon->read_only = lp_readonly(snum);
  3310. @@ -2136,7 +2465,7 @@
  3311.                  lp_max_connections(SNUM(cnum)),False))
  3312.      {
  3313.        DEBUG(1,("too many connections - rejected\n"));
  3314. -      return(-4);
  3315. +      return(-8);
  3316.      }  
  3317.  
  3318.        if (lp_status(SNUM(cnum)))
  3319. @@ -2168,7 +2497,7 @@
  3320.      {
  3321.        DEBUG(0,("Can't change directory to %s\n",pcon->connectpath));
  3322.        pcon->open = False;
  3323. -      return(-1);      
  3324. +      return(-5);      
  3325.      }
  3326.  
  3327.    string_set(&pcon->origpath,pcon->connectpath);
  3328. @@ -2556,303 +2885,6 @@
  3329.      }
  3330.  }
  3331.  
  3332. -#ifdef QUOTAS
  3333. -#ifndef CRAY
  3334. -/****************************************************************************
  3335. -try to get the disk space from disk quotas
  3336. -****************************************************************************/
  3337. -static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
  3338. -{
  3339. -  uid_t user_id, euser_id;
  3340. -  char dev_disk[256];
  3341. -  struct dqblk D;
  3342. -  struct stat S;
  3343. -  /* find the block device file */
  3344. -  if ((stat(path, &S)<0) ||
  3345. -      (devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
  3346. -
  3347. -  euser_id = geteuid();
  3348. -
  3349. -#ifdef USE_SETRES
  3350. -  /* for HPUX, real uid must be same as euid to execute quotactl for euid */
  3351. -  user_id = getuid();
  3352. -  setresuid(euser_id,-1,-1);
  3353. -#endif
  3354. -  if (quotactl(Q_GETQUOTA, dev_disk, euser_id, &D)<0) return (False);
  3355. -#ifdef USE_SETRES
  3356. -  setresuid(user_id,-1,-1);
  3357. -#endif
  3358. -  /* Use softlimit to determine disk space, except when it has been exceeded */
  3359. -  *bsize = 1024;
  3360. -  if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curfiles>D.dqb_fsoftlimit)) 
  3361. -    {
  3362. -      *dfree = 0;
  3363. -      *dsize = D.dqb_curblocks;
  3364. -    }
  3365. -  else {
  3366. -    *dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
  3367. -    *dsize = D.dqb_bsoftlimit;
  3368. -  }
  3369. -  return (True);
  3370. -}
  3371. -#else
  3372. -/****************************************************************************
  3373. -try to get the disk space from disk quotas (CRAY VERSION)
  3374. -****************************************************************************/
  3375. -static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
  3376. -{
  3377. -  struct mntent *mnt;
  3378. -  FILE *fd;
  3379. -  struct stat sbuf;
  3380. -  dev_t devno ;
  3381. -  static dev_t devno_cached = 0 ;
  3382. -  static char name[MNTMAXSTR] ;
  3383. -  struct q_request request ;
  3384. -  struct qf_header header ;
  3385. -  static int quota_default = 0 ;
  3386. -  int found ;
  3387. -  
  3388. -  if ( stat(path,&sbuf) == -1 )
  3389. -    return(False) ;
  3390. -  
  3391. -  devno = sbuf.st_dev ;
  3392. -  
  3393. -  if ( devno != devno_cached ) {
  3394. -    
  3395. -    devno_cached = devno ;
  3396. -    
  3397. -    if ((fd = setmntent(KMTAB)) == NULL)
  3398. -      return(False) ;
  3399. -    
  3400. -    found = False ;
  3401. -    
  3402. -    while ((mnt = getmntent(fd)) != NULL) {
  3403. -      
  3404. -      if ( stat(mnt->mnt_dir,&sbuf) == -1 )
  3405. -    continue ;
  3406. -      
  3407. -      if (sbuf.st_dev == devno) {
  3408. -    
  3409. -    found = True ;
  3410. -    break ;
  3411. -    
  3412. -      }
  3413. -      
  3414. -    }
  3415. -    
  3416. -    strcpy(name,mnt->mnt_dir) ;
  3417. -    endmntent(fd) ;
  3418. -    
  3419. -    if ( ! found )
  3420. -      return(False) ;
  3421. -  }
  3422. -  
  3423. -  request.qf_magic = QF_MAGIC ;
  3424. -  request.qf_entry.id = geteuid() ;
  3425. -  
  3426. -  if (quotactl(name, Q_GETQUOTA, &request) == -1)
  3427. -    return(False) ;
  3428. -  
  3429. -  if ( ! request.user )
  3430. -    return(False) ;
  3431. -  
  3432. -  if ( request.qf_entry.user_q.f_quota == QFV_DEFAULT ) {
  3433. -    
  3434. -    if ( ! quota_default ) {
  3435. -      
  3436. -      if ( quotactl(name, Q_GETHEADER, &header) == -1 )
  3437. -    return(False) ;
  3438. -      else
  3439. -    quota_default = header.user_h.def_fq ;
  3440. -    }
  3441. -    
  3442. -    *dfree = quota_default ;
  3443. -    
  3444. -  }else if ( request.qf_entry.user_q.f_quota == QFV_PREVENT ) {
  3445. -    
  3446. -    *dfree = 0 ;
  3447. -    
  3448. -  }else{
  3449. -    
  3450. -    *dfree = request.qf_entry.user_q.f_quota ;
  3451. -    
  3452. -  }
  3453. -  
  3454. -  *dsize = request.qf_entry.user_q.f_use ;
  3455. -  
  3456. -  if ( *dfree )
  3457. -    *dfree -= *dsize ;
  3458. -  
  3459. -  if ( *dfree < 0 )
  3460. -    *dfree = 0 ;
  3461. -  
  3462. -  *bsize = 4096 ;  /* Cray blocksize */
  3463. -  
  3464. -  return(True) ;
  3465. -  
  3466. -}
  3467. -#endif /* CRAY */
  3468. -#endif /* QUOTAS */
  3469. -
  3470. -
  3471. -/****************************************************************************
  3472. -normalise for DOS usage 
  3473. -****************************************************************************/
  3474. -static void disk_norm(int *bsize,int *dfree,int *dsize)
  3475. -{
  3476. -  /* check if the disk is beyond the max disk size */
  3477. -  int maxdisksize = lp_maxdisksize();
  3478. -  if (maxdisksize) {
  3479. -    /* convert to blocks - and don't overflow */
  3480. -    maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
  3481. -    if (*dsize > maxdisksize) *dsize = maxdisksize;
  3482. -    if (*dfree > maxdisksize) *dfree = maxdisksize-1; /* the -1 should stop 
  3483. -                             applications getting 
  3484. -                             div by 0 errors */
  3485. -  }  
  3486. -
  3487. -  while (*dfree > WORDMAX || *dsize > WORDMAX || *bsize < 512) 
  3488. -    {
  3489. -      *dfree /= 2;
  3490. -      *dsize /= 2;
  3491. -      *bsize *= 2;
  3492. -      if (*bsize > WORDMAX )
  3493. -    {
  3494. -      *bsize = WORDMAX;
  3495. -      if (*dsize > WORDMAX)
  3496. -        *dsize = WORDMAX;
  3497. -      if (*dfree >  WORDMAX)
  3498. -        *dfree = WORDMAX;
  3499. -      break;
  3500. -    }
  3501. -    }
  3502. -}
  3503. -
  3504. -/****************************************************************************
  3505. -  return number of 1K blocks available on a path and total number 
  3506. -****************************************************************************/
  3507. -int disk_free(char *path,int *bsize,int *dfree,int *dsize)
  3508. -{
  3509. -  char *df_command = lp_dfree_command();
  3510. -#ifdef USE_STATVFS
  3511. -  struct statvfs fs;
  3512. -#else
  3513. -#ifdef ULTRIX
  3514. -  struct fs_data fs;
  3515. -#else
  3516. -  struct statfs fs;
  3517. -#endif
  3518. -#endif
  3519. -
  3520. -#ifdef QUOTAS
  3521. -  if (disk_quotas(path, bsize, dfree, dsize))
  3522. -    {
  3523. -      disk_norm(bsize,dfree,dsize);
  3524. -      return(((*bsize)/1024)*(*dfree));
  3525. -    }
  3526. -#endif
  3527. -
  3528. -
  3529. -  /* possibly use system() to get the result */
  3530. -  if (df_command && *df_command)
  3531. -    {
  3532. -      int ret;
  3533. -      pstring syscmd;
  3534. -      pstring outfile;
  3535. -      
  3536. -      sprintf(outfile,"/tmp/dfree.smb.%d",(int)getpid());
  3537. -      sprintf(syscmd,"%s %s",df_command,path);
  3538. -      standard_sub(current_cnum,syscmd);
  3539. -
  3540. -      ret = smbrun(syscmd,outfile);
  3541. -      DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
  3542. -      
  3543. -      {
  3544. -    FILE *f = fopen(outfile,"r");    
  3545. -    *dsize = 0;
  3546. -    *dfree = 0;
  3547. -    *bsize = 1024;
  3548. -    if (f)
  3549. -      {
  3550. -        fscanf(f,"%d %d %d",dsize,dfree,bsize);
  3551. -        fclose(f);
  3552. -      }
  3553. -    else
  3554. -      DEBUG(0,("Can't open %s\n",outfile));
  3555. -      }
  3556. -      
  3557. -      unlink(outfile);
  3558. -      disk_norm(bsize,dfree,dsize);
  3559. -      return(((*bsize)/1024)*(*dfree));
  3560. -    }
  3561. -
  3562. -
  3563. -#ifdef STATFS4
  3564. -  if (statfs(path,&fs,sizeof(fs),0) != 0)
  3565. -#else
  3566. -#ifdef USE_STATVFS
  3567. -    if (statvfs(path, &fs))
  3568. -#else
  3569. -#ifdef STATFS3
  3570. -      if (statfs(path,&fs,sizeof(fs)) == -1)     
  3571. -#else
  3572. -    if (statfs(path,&fs) == -1)
  3573. -#endif /* STATFS3 */
  3574. -#endif /* USE_STATVFS */
  3575. -#endif /* STATFS4 */
  3576. -      {
  3577. -        DEBUG(3,("dfree call failed code errno=%d\n",errno));
  3578. -        *bsize = 1024;
  3579. -        *dfree = 1;
  3580. -        *dsize = 1;
  3581. -        return(((*bsize)/1024)*(*dfree));
  3582. -      }
  3583. -
  3584. -#ifdef ULTRIX
  3585. -  *bsize = 1024;
  3586. -  *dfree = fs.fd_req.bfree;
  3587. -  *dsize = fs.fd_req.btot;
  3588. -#else
  3589. -#ifdef USE_STATVFS
  3590. -  *bsize = fs.f_frsize;
  3591. -#else
  3592. -#ifdef USE_F_FSIZE
  3593. -  /* eg: osf1 has f_fsize = fundamental filesystem block size, 
  3594. -     f_bsize = optimal transfer block size (MX: 94-04-19) */
  3595. -  *bsize = fs.f_fsize;
  3596. -#else
  3597. -  *bsize = fs.f_bsize;
  3598. -#endif /* STATFS3 */
  3599. -#endif /* USE_STATVFS */
  3600. -
  3601. -#ifdef STATFS4
  3602. -  *dfree = fs.f_bfree;
  3603. -#else
  3604. -  *dfree = fs.f_bavail;
  3605. -#endif /* STATFS4 */
  3606. -  *dsize = fs.f_blocks;
  3607. -#endif /* ULTRIX */
  3608. -
  3609. -#if defined(SCO) || defined(ISC) || defined(MIPS)
  3610. -  *bsize = 512;
  3611. -#endif
  3612. -
  3613. -/* handle rediculous bsize values - some OSes are broken */
  3614. -if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024;
  3615. -
  3616. -  disk_norm(bsize,dfree,dsize);
  3617. -
  3618. -  if (*bsize < 256)
  3619. -    *bsize = 512;
  3620. -  if ((*dsize)<1)
  3621. -    {
  3622. -      DEBUG(0,("dfree seems to be broken on your system\n"));
  3623. -      *dsize = 20*1024*1024/(*bsize);
  3624. -      *dfree = MAX(1,*dfree);
  3625. -    }
  3626. -  return(((*bsize)/1024)*(*dfree));
  3627. -}
  3628. -
  3629.  
  3630.  /****************************************************************************
  3631.  close all open files for a connection
  3632. @@ -2874,6 +2906,8 @@
  3633.  void close_cnum(int cnum, int uid)
  3634.  {
  3635.    extern struct from_host Client_info;
  3636. +
  3637. +  DirCacheFlush(SNUM(cnum));
  3638.  
  3639.    unbecome_user();
  3640.  
  3641. diff -u -r --new-file last-version/source/smb.h samba-1.9.14alpha17/source/smb.h
  3642. --- last-version/source/smb.h    Tue Sep 12 20:02:54 1995
  3643. +++ samba-1.9.14alpha17/source/smb.h    Fri Sep 15 21:14:23 1995
  3644. @@ -295,6 +295,7 @@
  3645.    int job;
  3646.    int size;
  3647.    int status;
  3648. +  int priority;
  3649.    time_t time;
  3650.    char user[30];
  3651.    char file[100];
  3652. @@ -561,6 +562,21 @@
  3653.  
  3654.  /* and a few prototypes */
  3655.  int sys_select(fd_set *fds,struct timeval *tval);
  3656. +int sys_unlink(char *fname);
  3657. +int sys_open(char *fname,int flags,int mode);
  3658. +DIR *sys_opendir(char *dname);
  3659. +int sys_stat(char *fname,struct stat *sbuf);
  3660. +int sys_lstat(char *fname,struct stat *sbuf);
  3661. +int sys_mkdir(char *dname,int mode);
  3662. +int sys_rmdir(char *dname);
  3663. +int sys_chdir(char *dname);
  3664. +int sys_utime(char *fname,struct utimbuf *times);
  3665. +int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
  3666. +void lpq_reset(int);
  3667. +void status_printjob(int cnum,int snum,int jobid,int status);
  3668. +void DirCacheAdd(char *path,char *name,char *dname,int snum);
  3669. +char *DirCacheCheck(char *path,char *name,int snum);
  3670. +void DirCacheFlush(int snum);
  3671.  int interpret_character_set(char *str, int def);
  3672.  char *dos2unix_format(char *, BOOL);
  3673.  char *unix2dos_format(char *, BOOL);
  3674. diff -u -r --new-file last-version/source/system.c samba-1.9.14alpha17/source/system.c
  3675. --- last-version/source/system.c    Tue Sep 12 16:14:57 1995
  3676. +++ samba-1.9.14alpha17/source/system.c    Fri Sep 15 21:18:15 1995
  3677. @@ -28,6 +28,8 @@
  3678.     - to enable easier porting by putting OS dependent stuff in here
  3679.  
  3680.     - to allow for hooks into other "pseudo-filesystems"
  3681. +
  3682. +   - to allow easier integration of things like the japanese extensions
  3683.  */
  3684.  
  3685.  
  3686. @@ -100,3 +102,83 @@
  3687.    return(selrtn);
  3688.  }
  3689.  #endif
  3690. +
  3691. +
  3692. +/*******************************************************************
  3693. +just a unlink wrapper
  3694. +********************************************************************/
  3695. +int sys_unlink(char *fname)
  3696. +{
  3697. +  return(unlink(dos_to_unix(fname,False)));
  3698. +}
  3699. +
  3700. +
  3701. +/*******************************************************************
  3702. +a simple open() wrapper
  3703. +********************************************************************/
  3704. +int sys_open(char *fname,int flags,int mode)
  3705. +{
  3706. +  return(open(dos_to_unix(fname,False),flags,mode));
  3707. +}
  3708. +
  3709. +
  3710. +/*******************************************************************
  3711. +a simple opendir() wrapper
  3712. +********************************************************************/
  3713. +DIR *sys_opendir(char *dname)
  3714. +{
  3715. +  return(opendir(dos_to_unix(dname,False)));
  3716. +}
  3717. +
  3718. +
  3719. +/*******************************************************************
  3720. +and a stat() wrapper
  3721. +********************************************************************/
  3722. +int sys_stat(char *fname,struct stat *sbuf)
  3723. +{
  3724. +  return(stat(dos_to_unix(fname,False),sbuf));
  3725. +}
  3726. +
  3727. +/*******************************************************************
  3728. +don't forget lstat()
  3729. +********************************************************************/
  3730. +int sys_lstat(char *fname,struct stat *sbuf)
  3731. +{
  3732. +  return(lstat(dos_to_unix(fname,False),sbuf));
  3733. +}
  3734. +
  3735. +
  3736. +/*******************************************************************
  3737. +mkdir() gets a wrapper
  3738. +********************************************************************/
  3739. +int sys_mkdir(char *dname,int mode)
  3740. +{
  3741. +  return(mkdir(dos_to_unix(dname,False),mode));
  3742. +}
  3743. +
  3744. +
  3745. +/*******************************************************************
  3746. +do does rmdir()
  3747. +********************************************************************/
  3748. +int sys_rmdir(char *dname)
  3749. +{
  3750. +  return(rmdir(dos_to_unix(dname,False)));
  3751. +}
  3752. +
  3753. +
  3754. +/*******************************************************************
  3755. +I almost forgot chdir()
  3756. +********************************************************************/
  3757. +int sys_chdir(char *dname)
  3758. +{
  3759. +  return(chdir(dos_to_unix(dname,False)));
  3760. +}
  3761. +
  3762. +
  3763. +/*******************************************************************
  3764. +now for utime()
  3765. +********************************************************************/
  3766. +int sys_utime(char *fname,struct utimbuf *times)
  3767. +{
  3768. +  return(utime(dos_to_unix(fname,False),times));
  3769. +}
  3770. diff -u -r --new-file last-version/source/trans2.c samba-1.9.14alpha17/source/trans2.c
  3771. --- last-version/source/trans2.c    Tue Sep 12 21:27:13 1995
  3772. +++ samba-1.9.14alpha17/source/trans2.c    Fri Sep 15 21:21:00 1995
  3773. @@ -312,7 +312,7 @@
  3774.        strcpy(pathreal,Connections[cnum].dirpath);
  3775.        strcat(pathreal,"/");
  3776.        strcat(pathreal,fname);
  3777. -      if (stat(pathreal,&sbuf) != 0) 
  3778. +      if (sys_stat(pathreal,&sbuf) != 0) 
  3779.          {
  3780.            DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno)));
  3781.            continue;
  3782. @@ -866,7 +866,7 @@
  3783.    
  3784.    DEBUG(3,("call_trans2qfsinfo: cnum = %d, level = %d\n", cnum, info_level));
  3785.  
  3786. -  if(stat(".",&st)!=0) {
  3787. +  if(sys_stat(".",&st)!=0) {
  3788.      DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno)));
  3789.      return (ERROR(ERRSRV,ERRinvdevice));
  3790.    }
  3791. @@ -879,7 +879,7 @@
  3792.        {
  3793.      int dfree,dsize,bsize;
  3794.      data_len = 18;
  3795. -    disk_free(".",&bsize,&dfree,&dsize);    
  3796. +    sys_disk_free(".",&bsize,&dfree,&dsize);    
  3797.      SIVAL(pdata,l1_idFileSystem,st.st_dev);
  3798.      SIVAL(pdata,l1_cSectorUnit,bsize/512);
  3799.      SIVAL(pdata,l1_cUnit,dsize);
  3800. @@ -922,7 +922,7 @@
  3801.        {
  3802.      int dfree,dsize,bsize;
  3803.      data_len = 24;
  3804. -    disk_free(".",&bsize,&dfree,&dsize);    
  3805. +    sys_disk_free(".",&bsize,&dfree,&dsize);    
  3806.      SIVAL(pdata,0,dsize);
  3807.      SIVAL(pdata,8,dfree);
  3808.      SIVAL(pdata,16,bsize/512);
  3809. @@ -1004,7 +1004,7 @@
  3810.      fname = &fname1[0];
  3811.      strcpy(fname,¶ms[6]);
  3812.      unix_convert(fname,cnum);
  3813. -    if (!check_name(fname,cnum) || stat(fname,&sbuf)) {
  3814. +    if (!check_name(fname,cnum) || sys_stat(fname,&sbuf)) {
  3815.        DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno)));
  3816.        return(UNIXERROR(ERRDOS,ERRbadpath));
  3817.      }
  3818. @@ -1183,7 +1183,7 @@
  3819.      if(!check_name(fname, cnum))
  3820.        return(ERROR(ERRDOS,ERRbadpath));
  3821.      
  3822. -    if(stat(fname,&st)!=0) {
  3823. +    if(sys_stat(fname,&st)!=0) {
  3824.        DEBUG(3,("stat of %s failed (%s)\n", fname, strerror(errno)));
  3825.        return(ERROR(ERRDOS,ERRbadpath));
  3826.      }    
  3827. @@ -1263,7 +1263,7 @@
  3828.    /* Try and set the times, size and mode of this file - if they are different 
  3829.     from the current values */
  3830.    if(st.st_mtime != tvs.modtime || st.st_atime != tvs.actime) {
  3831. -    if(utime(fname, &tvs)!=0)
  3832. +    if(sys_utime(fname, &tvs)!=0)
  3833.        return(ERROR(ERRDOS,ERRnoaccess));
  3834.    }
  3835.    if(mode != dos_mode(cnum,fname,&st) && dos_chmod(cnum,fname,mode)) {
  3836. @@ -1272,7 +1272,7 @@
  3837.    }
  3838.    if(size != st.st_size) {
  3839.      if (fd == -1) {
  3840. -      fd = open(fname,O_RDWR);
  3841. +      fd = sys_open(fname,O_RDWR,0);
  3842.        if (fd == -1)
  3843.      return(ERROR(ERRDOS,ERRbadpath));
  3844.        set_filelen(fd, size);
  3845. @@ -1308,7 +1308,7 @@
  3846.  
  3847.    unix_convert(directory,cnum);
  3848.    if (check_name(directory,cnum))
  3849. -    ret = mkdir(directory,unix_mode(cnum,aDIR));
  3850. +    ret = sys_mkdir(directory,unix_mode(cnum,aDIR));
  3851.    
  3852.    if(ret < 0)
  3853.      {
  3854. diff -u -r --new-file last-version/source/ufc.c samba-1.9.14alpha17/source/ufc.c
  3855. --- last-version/source/ufc.c    Sat Apr 15 20:30:24 1995
  3856. +++ samba-1.9.14alpha17/source/ufc.c    Thu Sep 14 17:16:06 1995
  3857. @@ -10,6 +10,10 @@
  3858.     Under SunOS I found a huge speedup by using these routines 
  3859.     (a factor of 20 or so)
  3860.  
  3861. +   Warning: I've had a report from Steve Kennedy <steve@gbnet.org>
  3862. +   that this crypt routine may sometimes get the wrong answer. Only
  3863. +   use UFC_CRYT if you really need it.
  3864. +
  3865.  */
  3866.  
  3867.  #ifdef UFC_CRYPT
  3868. diff -u -r --new-file last-version/source/util.c samba-1.9.14alpha17/source/util.c
  3869. --- last-version/source/util.c    Tue Sep 12 21:02:39 1995
  3870. +++ samba-1.9.14alpha17/source/util.c    Fri Sep 15 21:06:29 1995
  3871. @@ -751,7 +751,7 @@
  3872.    struct stat st;
  3873.    if (!sbuf) sbuf = &st;
  3874.    
  3875. -  if (stat(fname,sbuf) != 0) 
  3876. +  if (sys_stat(fname,sbuf) != 0) 
  3877.      return(False);
  3878.  
  3879.    return(S_ISREG(sbuf->st_mode));
  3880. @@ -764,7 +764,7 @@
  3881.  {
  3882.    struct stat st;
  3883.    
  3884. -  if (stat(fname,&st) != 0) 
  3885. +  if (sys_stat(fname,&st) != 0) 
  3886.      return(0);
  3887.  
  3888.    return(st.st_mtime);
  3889. @@ -777,7 +777,7 @@
  3890.  {
  3891.    struct stat st;
  3892.  
  3893. -  if (stat(dname,&st) != 0) 
  3894. +  if (sys_stat(dname,&st) != 0) 
  3895.      return(False);
  3896.  
  3897.    return(S_ISDIR(st.st_mode));
  3898. @@ -790,7 +790,7 @@
  3899.  {
  3900.    struct stat buf;
  3901.    buf.st_size = 0;
  3902. -  stat(file_name,&buf);
  3903. +  sys_stat(file_name,&buf);
  3904.    return(buf.st_size);
  3905.  }
  3906.  
  3907. @@ -1312,7 +1312,7 @@
  3908.    if (*path == '/' && strcsequal(LastDir,path)) return(0);
  3909.    DEBUG(3,("chdir to %s\n",path));
  3910.    strcpy(LastDir,path);
  3911. -  return(chdir(path));
  3912. +  return(sys_chdir(path));
  3913.  }
  3914.  
  3915.  
  3916. @@ -3225,7 +3225,7 @@
  3917.  
  3918.    times.modtime = times.actime = mtime;
  3919.  
  3920. -  if (utime(fname,×)) {
  3921. +  if (sys_utime(fname,×)) {
  3922.      DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno)));
  3923.    }
  3924.      
  3925. @@ -3849,14 +3849,25 @@
  3926.  BOOL process_exists(int pid)
  3927.  {
  3928.  #ifdef LINUX
  3929. -  pstring s;
  3930. +  fstring s;
  3931.    sprintf(s,"/proc/%d",pid);
  3932.    return(directory_exist(s));
  3933. -#elif defined(SUNOS5)
  3934. -  pstring s;
  3935. -  sprintf(s,"/proc/%05d",pid);
  3936. -  return(file_exist(s,NULL));
  3937.  #else
  3938. +  {
  3939. +    static BOOL tested=False;
  3940. +    static BOOL ok=False;
  3941. +    fstring s;
  3942. +    if (!tested) {
  3943. +      tested = True;
  3944. +      sprintf(s,"/proc/%05d",getpid());
  3945. +      ok = file_exist(s,NULL);
  3946. +    }
  3947. +    if (ok) {
  3948. +      sprintf(s,"/proc/%05d",pid);
  3949. +      return(file_exist(s,NULL));
  3950. +    }
  3951. +  }
  3952. +
  3953.    /* a best guess for non root access */
  3954.    if (geteuid() != 0) return(True);
  3955.  
  3956. diff -u -r --new-file last-version/source/version.h samba-1.9.14alpha17/source/version.h
  3957. --- last-version/source/version.h    Thu Sep 14 00:12:21 1995
  3958. +++ samba-1.9.14alpha17/source/version.h    Fri Sep 15 22:24:01 1995
  3959. @@ -1 +1 @@
  3960. -#define VERSION "1.9.14alpha16"
  3961. +#define VERSION "1.9.14alpha17"
  3962.